This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/51559] decimal128 operates incorrectly compared to decimal32 and decimal64


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]