[Bug middle-end/21718] real.c rounding not perfect

joseph at codesourcery dot com gcc-bugzilla@gcc.gnu.org
Mon Nov 5 20:49:00 GMT 2012


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

--- Comment #15 from joseph at codesourcery dot com <joseph at codesourcery dot com> 2012-11-05 20:49:24 UTC ---
The glibc code is pretty complicated (using glibc's copies of mpn_* 
low-level GMP functions for multiple-precision arithmetic) and entangled 
with other bits of glibc (it needs to handle things such as locales / 
thousands grouping characters, which are not relevant to GCC).  And of 
course there is no guarantee that the host has any floating-point type 
corresponding to the required type on the target.  Even working around the 
absence of a reliable ternary value in some supported MPFR versions, using 
MPFR for this would be much simpler than adapting the glibc code for use 
in GCC - it's the natural thing to do, given the use of MPFR for built-in 
function evaluation in GCC.  (MPFR should also be used to replace 
real_sqrt - real.c doesn't use enough bits internally to get a correctly 
rounded sqrt result in all cases.  fold_builtin_sqrt already does use 
mpfr_sqrt.)



More information about the Gcc-bugs mailing list