From a1cbf437a53b24f2ff1f6af42028b607f6aa279d Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Thu, 4 Apr 2013 17:35:12 +0200 Subject: [BZ #14686, #15336] Fix standard compliance. Don't use hard-coded qNaN values. --- sysdeps/ieee754/dbl-64/e_remainder.c | 14 ++++++++------ sysdeps/ieee754/dbl-64/urem.h | 8 ++------ 2 files changed, 10 insertions(+), 12 deletions(-) (limited to 'sysdeps/ieee754/dbl-64') 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; } } } diff --git a/sysdeps/ieee754/dbl-64/urem.h b/sysdeps/ieee754/dbl-64/urem.h index c4daa5d1ac..b576691ced 100644 --- a/sysdeps/ieee754/dbl-64/urem.h +++ b/sysdeps/ieee754/dbl-64/urem.h @@ -32,18 +32,14 @@ static const mynumber big = {{0x43380000, 0}}, /* 6755399441055744 */ t128 = {{0x47f00000, 0}}, /* 2^ 128 */ tm128 = {{0x37f00000, 0}}, /* 2^-128 */ ZERO = {{0, 0}}, /* 0.0 */ - nZERO = {{0x80000000, 0}}, /* -0.0 */ - NAN = {{0x7ff80000, 0}}, /* NaN */ - nNAN = {{0xfff80000, 0}}; /* -NaN */ + nZERO = {{0x80000000, 0}}; /* -0.0 */ #else #ifdef LITTLE_ENDI static const mynumber big = {{0, 0x43380000}}, /* 6755399441055744 */ t128 = {{0, 0x47f00000}}, /* 2^ 128 */ tm128 = {{0, 0x37f00000}}, /* 2^-128 */ ZERO = {{0, 0}}, /* 0.0 */ - nZERO = {{0, 0x80000000}}, /* -0.0 */ - NAN = {{0, 0x7ff80000}}, /* NaN */ - nNAN = {{0, 0xfff80000}}; /* -NaN */ + nZERO = {{0, 0x80000000}}; /* -0.0 */ #endif #endif -- cgit v1.2.3