aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/ieee754/ldbl-128
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2012-05-01 15:37:43 +0000
committerJoseph Myers <joseph@codesourcery.com>2012-05-01 15:37:43 +0000
commit7cb029ee6ec74801aebe41af62d20a44775d0697 (patch)
tree68ee5f5b88832c10bc1c7560cc9f1651104aebf0 /sysdeps/ieee754/ldbl-128
parent412bd96612ff5422befb98e990b66d10c26a4b21 (diff)
downloadglibc-7cb029ee6ec74801aebe41af62d20a44775d0697.tar
glibc-7cb029ee6ec74801aebe41af62d20a44775d0697.tar.gz
glibc-7cb029ee6ec74801aebe41af62d20a44775d0697.tar.bz2
glibc-7cb029ee6ec74801aebe41af62d20a44775d0697.zip
Fix nexttoward bugs (bugs 2550, 2570).
Diffstat (limited to 'sysdeps/ieee754/ldbl-128')
-rw-r--r--sysdeps/ieee754/ldbl-128/s_nexttoward.c12
-rw-r--r--sysdeps/ieee754/ldbl-128/s_nexttowardf.c8
2 files changed, 4 insertions, 16 deletions
diff --git a/sysdeps/ieee754/ldbl-128/s_nexttoward.c b/sysdeps/ieee754/ldbl-128/s_nexttoward.c
index 87a9a6cac3..1ea0b64331 100644
--- a/sysdeps/ieee754/ldbl-128/s_nexttoward.c
+++ b/sysdeps/ieee754/ldbl-128/s_nexttoward.c
@@ -55,11 +55,7 @@ double __nexttoward(double x, long double y)
return x;
}
if(hx>=0) { /* x > 0 */
- if (hy<0||(ix>>20)>(iy>>48)-0x3c00
- || ((ix>>20)==(iy>>48)-0x3c00
- && (((((int64_t)hx)<<28)|(lx>>4))>(hy&0x0000ffffffffffffLL)
- || (((((int64_t)hx)<<28)|(lx>>4))==(hy&0x0000ffffffffffffLL)
- && (lx&0xf)>(ly>>60))))) { /* x > y, x -= ulp */
+ if (x > y) { /* x -= ulp */
if(lx==0) hx -= 1;
lx -= 1;
} else { /* x < y, x += ulp */
@@ -67,11 +63,7 @@ double __nexttoward(double x, long double y)
if(lx==0) hx += 1;
}
} else { /* x < 0 */
- if (hy>=0||(ix>>20)>(iy>>48)-0x3c00
- || ((ix>>20)==(iy>>48)-0x3c00
- && (((((int64_t)hx)<<28)|(lx>>4))>(hy&0x0000ffffffffffffLL)
- || (((((int64_t)hx)<<28)|(lx>>4))==(hy&0x0000ffffffffffffLL)
- && (lx&0xf)>(ly>>60))))) { /* x < y, x -= ulp */
+ if (x < y) { /* x -= ulp */
if(lx==0) hx -= 1;
lx -= 1;
} else { /* x > y, x += ulp */
diff --git a/sysdeps/ieee754/ldbl-128/s_nexttowardf.c b/sysdeps/ieee754/ldbl-128/s_nexttowardf.c
index 371fa80771..02a14078af 100644
--- a/sysdeps/ieee754/ldbl-128/s_nexttowardf.c
+++ b/sysdeps/ieee754/ldbl-128/s_nexttowardf.c
@@ -46,17 +46,13 @@ float __nexttowardf(float x, long double y)
return x;
}
if(hx>=0) { /* x > 0 */
- if(hy<0||(ix>>23)>(iy>>48)-0x3f80
- || ((ix>>23)==(iy>>48)-0x3f80
- && (ix&0x7fffff)>((hy>>25)&0x7fffff))) {/* x > y, x -= ulp */
+ if(x > y) { /* x -= ulp */
hx -= 1;
} else { /* x < y, x += ulp */
hx += 1;
}
} else { /* x < 0 */
- if(hy>=0||(ix>>23)>(iy>>48)-0x3f80
- || ((ix>>23)==(iy>>48)-0x3f80
- && (ix&0x7fffff)>((hy>>25)&0x7fffff))) {/* x < y, x -= ulp */
+ if(x < y) { /* x < y, x -= ulp */
hx -= 1;
} else { /* x > y, x += ulp */
hx += 1;