Commit 63f90eb7 by John David Anglin Committed by John David Anglin

re PR libfortran/33595 (FAIL: gfortran.dg/nint_2.f90 -O0 execution test)

	PR fortran/33595
	* intrinsics/c99_functions.c (round): Use floor instead of ceil.
	Revise checks to round up.
	(roundf): Likewise.

From-SVN: r145209
parent 8272d11d
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.
2009-03-28 Daniel Kraft <d@domob.eu> 2009-03-28 Daniel Kraft <d@domob.eu>
* intrinsics/string_intrinsics.c: #include <assert.h> * intrinsics/string_intrinsics.c: #include <assert.h>
......
...@@ -571,16 +571,16 @@ round(double x) ...@@ -571,16 +571,16 @@ round(double x)
if (x >= 0.0) if (x >= 0.0)
{ {
t = ceil(x); t = floor(x);
if (t - x > 0.5) if (t - x <= -0.5)
t -= 1.0; t += 1.0;
return (t); return (t);
} }
else else
{ {
t = ceil(-x); t = floor(-x);
if (t + x > 0.5) if (t + x <= -0.5)
t -= 1.0; t += 1.0;
return (-t); return (-t);
} }
} }
...@@ -600,16 +600,16 @@ roundf(float x) ...@@ -600,16 +600,16 @@ roundf(float x)
if (x >= 0.0) if (x >= 0.0)
{ {
t = ceilf(x); t = floorf(x);
if (t - x > 0.5) if (t - x <= -0.5)
t -= 1.0; t += 1.0;
return (t); return (t);
} }
else else
{ {
t = ceilf(-x); t = floorf(-x);
if (t + x > 0.5) if (t + x <= -0.5)
t -= 1.0; t += 1.0;
return (-t); return (-t);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment