diff options
author | Adhemerval Zanella <azanella@linux.vnet.ibm.com> | 2012-05-02 15:14:17 +0200 |
---|---|---|
committer | Andreas Jaeger <aj@suse.de> | 2012-05-02 15:14:17 +0200 |
commit | 4f9d04aa8fcc5008995409d524086121e9a840dc (patch) | |
tree | 0d00b6f6cd08a464ecbbb7755122d22e2cea8744 /sysdeps/ieee754/ldbl-128ibm | |
parent | f5a01ca927f9141606276b05ad87974593a608a1 (diff) | |
download | glibc-4f9d04aa8fcc5008995409d524086121e9a840dc.tar.gz glibc-4f9d04aa8fcc5008995409d524086121e9a840dc.tar.xz glibc-4f9d04aa8fcc5008995409d524086121e9a840dc.zip |
Fix nexttoward bugs
[BZ #2550] [BZ #2570] * sysdeps/ieee754/ldbl-128ibm/s_nexttoward.c: Use floating-point comparisons to determine direction to adjust input.
Diffstat (limited to 'sysdeps/ieee754/ldbl-128ibm')
-rw-r--r-- | sysdeps/ieee754/ldbl-128ibm/s_nexttoward.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_nexttoward.c b/sysdeps/ieee754/ldbl-128ibm/s_nexttoward.c index 9ecfef179b..40f0c46990 100644 --- a/sysdeps/ieee754/ldbl-128ibm/s_nexttoward.c +++ b/sysdeps/ieee754/ldbl-128ibm/s_nexttoward.c @@ -57,11 +57,7 @@ double __nexttoward(double x, long double y) return x; } if(hx>=0) { /* x > 0 */ - if (hy<0||(ix>>20)>(iy>>52) - || ((ix>>20)==(iy>>52) - && (((((int64_t)hx)<<32)|(lx))>(hy&0x000fffffffffffffLL) - || (((((int64_t)hx)<<32)|(lx))==(hy&0x000fffffffffffffLL) - )))) { /* x > y, x -= ulp */ + if (x > y) { /* x > 0 */ if(lx==0) hx -= 1; lx -= 1; } else { /* x < y, x += ulp */ @@ -69,11 +65,7 @@ double __nexttoward(double x, long double y) if(lx==0) hx += 1; } } else { /* x < 0 */ - if (hy>=0||(ix>>20)>(iy>>52) - || ((ix>>20)==(iy>>52) - && (((((int64_t)hx)<<32)|(lx))>(hy&0x000fffffffffffffLL) - || (((((int64_t)hx)<<32)|(lx))==(hy&0x000fffffffffffffLL) - )))) { /* x < y, x -= ulp */ + if (x < y) { /* x < 0 */ if(lx==0) hx -= 1; lx -= 1; } else { /* x > y, x += ulp */ |