This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/33595] FAIL: gfortran.dg/nint_2.f90 -O0 execution test
- From: "danglin at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 28 Dec 2008 20:25:17 -0000
- Subject: [Bug fortran/33595] FAIL: gfortran.dg/nint_2.f90 -O0 execution test
- References: <bug-33595-276@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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