about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1997-03-20 03:21:35 +0000
committerUlrich Drepper <drepper@redhat.com>1997-03-20 03:21:35 +0000
commitc1691f466142b115448e04d5174ab2346b4da4e4 (patch)
tree93042549101f4c4118681ef8b00056a5f0c0b1c9
parent41e2d0964834426db164c5e9b6f5d7a167815173 (diff)
downloadglibc-c1691f466142b115448e04d5174ab2346b4da4e4.tar.gz
glibc-c1691f466142b115448e04d5174ab2346b4da4e4.tar.xz
glibc-c1691f466142b115448e04d5174ab2346b4da4e4.zip
Correct former completely bogus code. It never worked correctly.
-rw-r--r--sysdeps/libm-ieee754/s_modfl.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/sysdeps/libm-ieee754/s_modfl.c b/sysdeps/libm-ieee754/s_modfl.c
index 433c936240..324fe9fde6 100644
--- a/sysdeps/libm-ieee754/s_modfl.c
+++ b/sysdeps/libm-ieee754/s_modfl.c
@@ -55,32 +55,29 @@ static long double one = 1.0;
 	    } else {
 		i = (0xffffffff)>>j0;
 		if(((i0&i)|i1)==0) {		/* x is integral */
-		    u_int32_t high;
 		    *iptr = x;
-		    GET_HIGH_WORD(high,x);
-		    INSERT_WORDS(x,high&0x80000000,0);	/* return +-0 */
+		    SET_LDOUBLE_WORDS(x,se&0x8000,0,0);	/* return +-0 */
 		    return x;
 		} else {
-		    INSERT_WORDS(*iptr,i0&(~i),0);
+		    SET_LDOUBLE_WORDS(*iptr,se,i0&(~i),0);
 		    return x - *iptr;
 		}
 	    }
 	} else if (j0>63) {		/* no fraction part */
-	    u_int32_t high;
 	    *iptr = x*one;
-	    GET_HIGH_WORD(high,x);
-	    INSERT_WORDS(x,high&0x80000000,0);	/* return +-0 */
+	    /* We must handle NaNs separately.  */
+	    if (j0 == 0x4000 && ((i0 & 0x7fffffff) | i1))
+	      return x*one;
+	    SET_LDOUBLE_WORDS(x,se&0x8000,0,0);	/* return +-0 */
 	    return x;
 	} else {			/* fraction part in low x */
 	    i = ((u_int32_t)(0xffffffff))>>(j0-20);
 	    if((i1&i)==0) { 		/* x is integral */
-	        u_int32_t high;
 		*iptr = x;
-		GET_HIGH_WORD(high,x);
-		INSERT_WORDS(x,high&0x80000000,0);	/* return +-0 */
+		INSERT_WORDS(x,se&0x8000,0);	/* return +-0 */
 		return x;
 	    } else {
-	        INSERT_WORDS(*iptr,i0,i1&(~i));
+		SET_LDOUBLE_WORDS(*iptr,se,i0,i1&(~i));
 		return x - *iptr;
 	    }
 	}