[Bug fortran/33595] FAIL: gfortran.dg/nint_2.f90 -O0 execution test
danglin at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Sun Dec 28 20:26:00 GMT 2008
------- Comment #8 from danglin at gcc dot gnu dot org 2008-12-28 20:25 -------
The value calculated for b = nearest(0.5,-1.0) is 0.49999997 (raw 0x3effffff).
The code uses the roundf implementation in c99_functions.
float
roundf(float x)
{
float t;
if (!isfinite (x))
return (x);
if (x >= 0.0)
{
t = ceilf(x);
if (t - x > 0.5)
t -= 1.0;
return (t);
}
else
{
t = ceilf(-x);
if (t + x > 0.5)
t -= 1.0;
return (-t);
}
}
The call to ceilf returns t = 1 (raw 0x3f800000). The result of t - x
is 0.5 (raw 0x3f000000). So, roundf returns 1 and the test fails.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33595
More information about the Gcc-bugs
mailing list