This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/51559] decimal128 operates incorrectly compared to decimal32 and decimal64
- From: "mingodad at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 15 Dec 2011 09:40:35 +0000
- Subject: [Bug c++/51559] decimal128 operates incorrectly compared to decimal32 and decimal64
- Auto-submitted: auto-generated
- References: <bug-51559-4@http.gcc.gnu.org/bugzilla/>
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.