#8160 closed Bugs (fixed)
multiprecision: Number is not assigned after dividing zero by something.
Reported by: | Owned by: | John Maddock | |
---|---|---|---|
Milestone: | To Be Determined | Component: | multiprecision |
Version: | Boost 1.53.0 | Severity: | Problem |
Keywords: | Cc: |
Description
#include <iostream> #include <boost/multiprecision/cpp_int.hpp> using boost::multiprecision::cpp_int; int main() { cpp_int a = 1; a = 0/cpp_int("1"); std::cout << "a = " << a << "\n"; // a = 1 return 0; }
divide.hpp: line 341 says All the limbs in x are zero, so is the result:
However, result is not assigned to zero.
Attachments (1)
Change History (7)
by , 10 years ago
comment:1 by , 10 years ago
Summary: | multiprecision: Number is not assinned after dividing zero by something. → multiprecision: Number is not assigned after dividing zero by something. |
---|
comment:3 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:4 by , 10 years ago
I just want to note that comparison with zero here isn't necessary.
There is:
if((r_order == 0) && (*pr == 0))
And few lines below:
if((r_order == 0) && (*pr < y))
There is no reason to treat zero as some special value, it will be handled by second if, so lines 339-345 can be simply removed.
comment:5 by , 10 years ago
Um.. clearly the bug I have at present has eaten my brains away :-(
Will fix shortly, thanks for your patience!
Note:
See TracTickets
for help on using tickets.
patch "boost/multiprecision"