https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110145

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Now, putting a breakpoint on round_for_format, seems the constant is actually
0xb.d176620a501fbffb650e5a93bc3d89854bea8f289011b2bp+415 or so before rounding
aka
0x1.7a2ecc414a03f7ff6ca1cb527787b130a97d51e51202365p+418, and long double on
ia32 has
63 bits of precision, so it is correctly rounded to
0x1.7a2ecc414a03f800p+418L when rounding to long double.
And that rounded to double is 0x1.7a2ecc414a040p+418.
While rounding the original long number immediately to 52 bits of precision
yields
0x1.7a2ecc414a03f0p+418.

double a = 1e126L;
double b = 1e126;

int
main ()
{
  __builtin_printf ("%.13a\n%.13a\n", a, b);
}

confirms this.
So, the issue is that with excess precision, we do double rounding of
constants, first
to long double and then to double, while without excess precision it is rounded
just once immediately to double.

Reply via email to