about summary refs log tree commit diff
path: root/sysdeps/ieee754/ldbl-96/s_nexttoward.c
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-96/s_nexttoward.c
parent412bd96612ff5422befb98e990b66d10c26a4b21 (diff)
downloadglibc-7cb029ee6ec74801aebe41af62d20a44775d0697.tar.gz
glibc-7cb029ee6ec74801aebe41af62d20a44775d0697.tar.xz
glibc-7cb029ee6ec74801aebe41af62d20a44775d0697.zip
Fix nexttoward bugs (bugs 2550, 2570).
Diffstat (limited to 'sysdeps/ieee754/ldbl-96/s_nexttoward.c')
-rw-r--r--sysdeps/ieee754/ldbl-96/s_nexttoward.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/sysdeps/ieee754/ldbl-96/s_nexttoward.c b/sysdeps/ieee754/ldbl-96/s_nexttoward.c
index 9b93ecae64..f7a8b2165a 100644
--- a/sysdeps/ieee754/ldbl-96/s_nexttoward.c
+++ b/sysdeps/ieee754/ldbl-96/s_nexttoward.c
@@ -52,11 +52,7 @@ double __nexttoward(double x, long double y)
 	    return x;
 	}
 	if(hx>=0) {				/* x > 0 */
-	    if (esy>=0x8000||((ix>>20)&0x7ff)>iy-0x3c00
-		|| (((ix>>20)&0x7ff)==iy-0x3c00
-		    && (((hx<<11)|(lx>>21))>(hy&0x7fffffff)
-			|| (((hx<<11)|(lx>>21))==(hy&0x7fffffff)
-			    && (lx<<11)>ly)))) {	/* x > y, x -= ulp */
+	    if (x > y) {			/* x -= ulp */
 		if(lx==0) hx -= 1;
 		lx -= 1;
 	    } else {				/* x < y, x += ulp */
@@ -64,11 +60,7 @@ double __nexttoward(double x, long double y)
 		if(lx==0) hx += 1;
 	    }
 	} else {				/* x < 0 */
-	    if (esy<0x8000||((ix>>20)&0x7ff)>iy-0x3c00
-		|| (((ix>>20)&0x7ff)==iy-0x3c00
-		    && (((hx<<11)|(lx>>21))>(hy&0x7fffffff)
-			|| (((hx<<11)|(lx>>21))==(hy&0x7fffffff)
-			    && (lx<<11)>ly))))	{/* x < y, x -= ulp */
+	    if (x < y) {			/* x -= ulp */
 		if(lx==0) hx -= 1;
 		lx -= 1;
 	    } else {				/* x > y, x += ulp */