Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#7878 closed Bugs (fixed)

Bug in integer division (assertion failed)

Reported by: Stepan Podoskin <stepik-777@…> Owned by: John Maddock
Milestone: To Be Determined Component: multiprecision
Version: Boost 1.53.0 Severity: Problem
Keywords: division Cc:

Description

boost::multiprecision::cpp_int a("79228162477370849454714781695");
a /= 0xFFFFFFFF;

This code generates the following runtime error:

Assertion failed: r.compare(y) < 0, file H:\prg\boost_1_53_0_beta1/boost/multiprecision/cpp_int/divide.hpp, line 438

Tested on MinGW, GCC 4.7.1

Change History (3)

comment:1 by Stepan Podoskin <stepik-777@…>, 10 years ago

Here is more simple example: 0x10000000100000001 / 1.

I'm testing it on 32-bit computer.

comment:2 by John Maddock, 10 years ago

Resolution: fixed
Status: newclosed

(In [82460]) Fix bug that causes division by single limb to fail when the remainder is zero and the least significant limb of the quotient is 1. Fixes #7878.

comment:3 by John Maddock, 10 years ago

(In [82497]) Fix bug in cpp_int division. Update docs. Refs #7878.

Note: See TracTickets for help on using tickets.