Backport from mainline
2009-03-29 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
PR fortran/33595
* intrinsics/c99_functions.c (round): Use floor instead of ceil.
Revise checks to round up.
(roundf): Likewise.
From-SVN: r165574
+2010-10-16 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
+
+ Backport from mainline:
+ 2009-03-29 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
+
+ PR fortran/33595
+ * intrinsics/c99_functions.c (round): Use floor instead of ceil.
+ Revise checks to round up.
+ (roundf): Likewise.
+
2010-10-06 Jerry DeLisle <jvdelisle@gcc.gnu.org>
Backport from mainline:
if (x >= 0.0)
{
- t = ceil(x);
- if (t - x > 0.5)
- t -= 1.0;
+ t = floor(x);
+ if (t - x <= -0.5)
+ t += 1.0;
return (t);
}
else
{
- t = ceil(-x);
- if (t + x > 0.5)
- t -= 1.0;
+ t = floor(-x);
+ if (t + x <= -0.5)
+ t += 1.0;
return (-t);
}
}
if (x >= 0.0)
{
- t = ceilf(x);
- if (t - x > 0.5)
- t -= 1.0;
+ t = floorf(x);
+ if (t - x <= -0.5)
+ t += 1.0;
return (t);
}
else
{
- t = ceilf(-x);
- if (t + x > 0.5)
- t -= 1.0;
+ t = floorf(-x);
+ if (t + x <= -0.5)
+ t += 1.0;
return (-t);
}
}