Opened 5 years ago
Closed 5 years ago
#13160 closed Bugs (duplicate)
cpp_dec_float fails division with on MinGW7.1 with optimization -O2
| Reported by: | Owned by: | John Maddock | |
|---|---|---|---|
| Milestone: | To Be Determined | Component: | multiprecision |
| Version: | Boost 1.63.0 | Severity: | Optimization |
| Keywords: | Cc: |
Description
When compiling the following on MinGW 7.1 with option -O2, the assertion fires.
It succeeds (as expected) with: -O3 debug (no optimization) -m64 (in all configurations)
#include <cassert>
#include <boost/multiprecision/cpp_dec_float.hpp>
typedef boost::multiprecision::number<boost::multiprecision::cpp_dec_float<50> > flp_type;
int main()
{
flp_type v1("1.33");
flp_type v2(50);
v1 /= v2;
assert(v1 == flp_type("0.0266"));
return 0;
}
Note:
See TracTickets
for help on using tickets.

Duplicates: #11178
I'm afraid division in cpp_dec_float is not exact - which is to say it doesn't round to the closest decimal, but stores guard digits instead.