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 middle-end/21718] real.c rounding not perfect



------- Comment #9 from exploringbinary at gmail dot com  2010-06-04 01:31 -------
I discovered two other examples of incorrect rounding in gcc: 

1) 0.500000000000000166533453693773481063544750213623046875
2) 1.50000000000000011102230246251565404236316680908203125

These are both halfway cases. Example 1 has bit 53 equal to 1, so it should
round up; gcc rounds down. Example 2 has bit 53 equal to 0, so it should round
down; gcc rounds up.

I've written an article describing these examples in more detail:
http://www.exploringbinary.com/incorrectly-rounded-conversions-in-gcc-and-glibc/
.

BTW, why doesn't gcc use David Gay's dtoa.c (http://www.netlib.org/fp/dtoa.c)
for correct rounding?


-- 

exploringbinary at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |exploringbinary at gmail dot
                   |                            |com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21718


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