]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR libfortran/33595 (FAIL: gfortran.dg/nint_2.f90 -O0 execution test)
authorJohn David Anglin <dave.anglin@nrc-cnrc.gc.ca>
Sun, 17 Oct 2010 00:29:12 +0000 (00:29 +0000)
committerJohn David Anglin <danglin@gcc.gnu.org>
Sun, 17 Oct 2010 00:29:12 +0000 (00:29 +0000)
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

libgfortran/ChangeLog
libgfortran/intrinsics/c99_functions.c

index 031bc7ae5a3f6c58903782f47be1050063e585a6..100645678f28af57535952433d158f6215331f4d 100644 (file)
@@ -1,3 +1,13 @@
+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:
index 9b31702342082a784f288152b3a95a8ba2b95f92..d4ed17fc1b00690bd49a18604e1bdad914e1a05f 100644 (file)
@@ -566,16 +566,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);
     }
 }
@@ -595,16 +595,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);
     }
 }