NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: lib/44741: strtod convert 0.010000000000000000057612911342378542997169 incorrectly
The following reply was made to PR lib/44741; it has been noted by GNATS.
From: Alexander Nasonov <alnsn%yandex.ru@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: lib-bug-people%netbsd.org@localhost, gnats-admin%netbsd.org@localhost,
netbsd-bugs%netbsd.org@localhost
Subject: Re: lib/44741: strtod convert
0.010000000000000000057612911342378542997169 incorrectly
Date: Sat, 19 Mar 2011 11:28:47 +0000
The bug is incorrect and should be closed.
strtod returns a number bit-to-bit identical to a floating-point
literal 0.010000000000000000057612911342378542997169. I use gcc 4.1.3.
I also checked using math/gsl and bc(1) that a binary representation of
that literal (1.0100011110101110000101000111101011100001010001111011*2^-7)
is closer to original decimal value than two nearest binaries (with 010
and 100 in least significant places).
literal: 0.010000000000000000057612911342378542997169
bin: 1.0100011110101110000101000111101011100001010001111010*2^-7
dec: 0.0099999999999999984734433411404097569175064563751220703125
diff: -0.0000000000000000015841695702019687860796625436248779296875
bin: 1.0100011110101110000101000111101011100001010001111011*2^-7
dec: 0.01000000000000000020816681711721685132943093776702880859375
diff: 0.00000000000000000015055390577483830833226193776702880859375 <-
smallest
bin: 1.0100011110101110000101000111101011100001010001111100*2^-7
dec: 0.010000000000000001942890293094023945741355419158935546875
diff: 0.000000000000000001885277381751645402744186419158935546875
Home |
Main Index |
Thread Index |
Old Index