]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR libfortran/33595 (FAIL: gfortran.dg/nint_2.f90 -O0 execution test)
authorJohn David Anglin <dave.anglin@nrc-cnrc.gc.ca>
Sat, 28 Mar 2009 21:15:45 +0000 (21:15 +0000)
committerJohn David Anglin <danglin@gcc.gnu.org>
Sat, 28 Mar 2009 21:15:45 +0000 (21:15 +0000)
PR fortran/33595
* intrinsics/c99_functions.c (round): Use floor instead of ceil.
Revise checks to round up.
(roundf): Likewise.

From-SVN: r145209

libgfortran/ChangeLog
libgfortran/intrinsics/c99_functions.c

index 45779d673fdefcb9c79fcfb65c48a182aa7d4629..e0ec2507052cfa6898a4d3cc86120651d6dedd6a 100644 (file)
@@ -1,3 +1,10 @@
+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>
 
        * intrinsics/string_intrinsics.c: #include <assert.h>
index ce96c8cb54b95d18101db68553c7990225a27989..66f06b323c8c591e5a9fde25ef83b0603f4b39c1 100644 (file)
@@ -571,16 +571,16 @@ round(double x)
 
    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);
     }
 }
@@ -600,16 +600,16 @@ roundf(float x)
 
    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);
     }
 }