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

--- Comment #29 from Joseph S. Myers <jsm28 at gcc dot gnu.org> ---
GCC supports lots of different floating-point formats, not all IEEE, including
variants such as "no subnormals" or "no infinities".  Using round to
zero/stickiness allows the existing GCC code that knows about the peculiarities
of these formats to do the final rounding for them, instead of needing to
replicate that logic specially for string conversions in order to use
mpfr_subnormalize.  Simple use of round-to-nearest without setting exponent
limits and mpfr_subnormalize would indeed result in problems with double
rounding.

d1c is slightly above half the least subnormal (d1a is slightly below, d1b is
exactly half the least subnormal), so should give the least subnormal as
result, which is what I get with current glibc.  Note that if GCC is running
with an MPFR version before 3.1.1p2, it's possible MPFR bugs will cause
incorrect results (I don't know if the bug in question affects the way GCC uses
MPFR).  (On 32-bit i686-pc-linux-gnu you'd have issues with excess precision
meaning constants are first interpreted as long double then later rounded to
their semantic type, hence the FLT_EVAL_METHOD conditionals.)

Reply via email to