This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/21718] real.c rounding not perfect
- From: "exploringbinary at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 4 Jun 2010 01:31:32 -0000
- Subject: [Bug middle-end/21718] real.c rounding not perfect
- References: <bug-21718-6@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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