about summary refs log tree commit diff
path: root/sysdeps/ieee754/dbl-64/e_remainder.c
diff options
context:
space:
mode:
authorThomas Schwinge <thomas@codesourcery.com>2013-04-04 17:35:12 +0200
committerThomas Schwinge <thomas@codesourcery.com>2013-04-05 22:34:52 +0200
commita1cbf437a53b24f2ff1f6af42028b607f6aa279d (patch)
tree3f62ac9a6413af55697ed6b154b400b518359406 /sysdeps/ieee754/dbl-64/e_remainder.c
parent8b43a0c9f26d5cf067119e47df9973515535673f (diff)
downloadglibc-a1cbf437a53b24f2ff1f6af42028b607f6aa279d.tar.gz
glibc-a1cbf437a53b24f2ff1f6af42028b607f6aa279d.tar.xz
glibc-a1cbf437a53b24f2ff1f6af42028b607f6aa279d.zip
[BZ #14686, #15336] Fix standard compliance. Don't use hard-coded qNaN values.
Diffstat (limited to 'sysdeps/ieee754/dbl-64/e_remainder.c')
-rw-r--r--sysdeps/ieee754/dbl-64/e_remainder.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/sysdeps/ieee754/dbl-64/e_remainder.c b/sysdeps/ieee754/dbl-64/e_remainder.c
index c4db9316c7..39ca0c2d0e 100644
--- a/sysdeps/ieee754/dbl-64/e_remainder.c
+++ b/sysdeps/ieee754/dbl-64/e_remainder.c
@@ -111,12 +111,14 @@ double __ieee754_remainder(double x, double y)
       else return (z>0)?z-y:z+y;
     }
     else { /* if x is too big */
-      if (kx == 0x7ff00000 && u.i[LOW_HALF] == 0 && y == 1.0)
-	return x / x;
-      if (kx>=0x7ff00000||(ky==0&&t.i[LOW_HALF]==0)||ky>0x7ff00000||
-	  (ky==0x7ff00000&&t.i[LOW_HALF]!=0))
-	return (u.i[HIGH_HALF]&0x80000000)?nNAN.x:NAN.x;
-      else return x;
+      if (ky==0 && t.i[LOW_HALF] == 0)		/* y = 0 */
+	return (x * y) / (x * y);
+      else if (kx >= 0x7ff00000			/* x not finite */
+	       || (ky>0x7ff00000		/* y is NaN */
+		   || (ky == 0x7ff00000 && t.i[LOW_HALF] != 0)))
+	return (x * y) / (x * y);
+      else
+	return x;
     }
    }
   }