[Bug c++/51559] decimal128 operates incorrectly compared to decimal32 and decimal64
mingodad at gmail dot com
gcc-bugzilla@gcc.gnu.org
Thu Dec 15 09:44:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51559
Domingo Alvarez <mingodad at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
--- Comment #2 from Domingo Alvarez <mingodad at gmail dot com> 2011-12-15 09:40:35 UTC ---
Doing more tests I discovered that the problem is inherent to using floating
points to initialize decimal128, doing it step by step with integer
initialization gives the expected result.
decimal128 d10(10), d1000(1000), d3(3), d99(99), d201(201);
d3 /= d10); //d3 = 0.3
d99 /= d1000; //d99 = 0.099
d3 -= d99; //d3 = 0.201
d3 *= d1000; // d3 = 201
now d3 == d201
Sorry by the false bug report.
More information about the Gcc-bugs
mailing list