This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc 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 libc/3479] Incorrect rounding in strtod()


http://sourceware.org/bugzilla/show_bug.cgi?id=3479

--- Comment #14 from Rich Felker <bugdal at aerifal dot cx> 2012-05-02 15:22:54 UTC ---
Doing this correctly in the naive way requires some expensive
extended-precision arithmetic. I think one (possibly) less expensive solution
can be found in John Salmon's citation of the recommended practice. If you
compute the result based on DECIMAL_DIG digits in the existing manner, but do
it for BOTH the neighboring values L and U. If the results for L and U are
equal, you're done. If not, you have to determine which of the two D is closer
to (for default rounding mode; other rounding modes are much easier) and this
probably involves converting at least one of them back to decimal, which might
cost you more than just doing the full-precision original calculation...

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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