------- Comment #10 from joseph at codesourcery dot com 2010-06-05 11:57 ------- Subject: Re: real.c rounding not perfect
On Fri, 4 Jun 2010, exploringbinary at gmail dot com wrote: > BTW, why doesn't gcc use David Gay's dtoa.c (http://www.netlib.org/fp/dtoa.c) > for correct rounding? Anything using the host's "double" or other floating-point types is fundamentally unsuitable for GCC floating-point handling, since GCC needs to handle many different floating-point formats for different targets on a single host, including target formats with no corresponding host format. The correct solution for GCC is well-established: use GNU MPFR for decimal-to-binary conversions (and for other arithmetic), which also makes it much more straightforward to handle the discontiguous mantissa cases of IBM long double. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21718