about summary refs log tree commit diff
path: root/sysdeps/i386/fpu/s_nextafterl.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-12-21 08:09:22 +0000
committerUlrich Drepper <drepper@redhat.com>2000-12-21 08:09:22 +0000
commite3bb40e6bff112c40fd7a3afaade03d564b4a95a (patch)
tree6157f8ede9a43b95aa60a37944d9efb56dd25a1d /sysdeps/i386/fpu/s_nextafterl.c
parentddc3ed9d3d646311f47a50cf80efc680fbc32a84 (diff)
downloadglibc-e3bb40e6bff112c40fd7a3afaade03d564b4a95a.tar.gz
glibc-e3bb40e6bff112c40fd7a3afaade03d564b4a95a.tar.xz
glibc-e3bb40e6bff112c40fd7a3afaade03d564b4a95a.zip
Add test for nextafter and 0.0.
Diffstat (limited to 'sysdeps/i386/fpu/s_nextafterl.c')
-rw-r--r--sysdeps/i386/fpu/s_nextafterl.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/sysdeps/i386/fpu/s_nextafterl.c b/sysdeps/i386/fpu/s_nextafterl.c
index 89adf04aec..b99914700c 100644
--- a/sysdeps/i386/fpu/s_nextafterl.c
+++ b/sysdeps/i386/fpu/s_nextafterl.c
@@ -52,12 +52,12 @@ static char rcsid[] = "$NetBSD: $";
 	   return x+y;
 	if(x==y) return y;		/* x=y, return y */
 	if((ix|hx|lx)==0) {			/* x == 0 */
-	    SET_LDOUBLE_WORDS(x,esx&0x8000,0,1);/* return +-minsubnormal */
+	    SET_LDOUBLE_WORDS(x,esy&0x8000,0,1);/* return +-minsubnormal */
 	    y = x*x;
 	    if(y==x) return y; else return x;	/* raise underflow flag */
 	}
 	if(esx>=0) {			/* x > 0 */
-	    if(ix>iy||((ix==iy) && (hx>hy||((hx==hy)&&(lx>ly))))) {
+	    if(esx>esy||((esx==esy) && (hx>hy||((hx==hy)&&(lx>ly))))) {
 	      /* x > y, x -= ulp */
 		if(lx==0) {
 		    if (hx <= 0x80000000) {
@@ -77,12 +77,14 @@ static char rcsid[] = "$NetBSD: $";
 		lx += 1;
 		if(lx==0) {
 		    hx += 1;
-		    if (hx==0 || (esx == 0 && hx == 0x80000000))
+		    if (hx==0 || (esx == 0 && hx == 0x80000000)) {
 			esx += 1;
+			hx |= 0x80000000;
+		    }
 		}
 	    }
 	} else {				/* x < 0 */
-	    if(esy>=0||(ix>iy||((ix==iy)&&(hx>hy||((hx==hy)&&(lx>ly)))))){
+	    if(esy>=0||(esx>esy||((esx==esy)&&(hx>hy||((hx==hy)&&(lx>ly)))))){
 	      /* x < y, x -= ulp */
 		if(lx==0) {
 		    if (hx <= 0x80000000) {
@@ -102,8 +104,10 @@ static char rcsid[] = "$NetBSD: $";
 		lx += 1;
 		if(lx==0) {
 		    hx += 1;
-		    if (hx==0 || (esx == 0xffff8000 && hx == 0x80000000))
-		      esx += 1;
+		    if (hx==0 || (esx == 0xffff8000 && hx == 0x80000000)) {
+			esx += 1;
+			hx |= 0x80000000;
+		    }
 		}
 	    }
 	}