diff options
author | Ulrich Drepper <drepper@redhat.com> | 1997-03-20 03:21:35 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1997-03-20 03:21:35 +0000 |
commit | c1691f466142b115448e04d5174ab2346b4da4e4 (patch) | |
tree | 93042549101f4c4118681ef8b00056a5f0c0b1c9 /sysdeps/libm-ieee754 | |
parent | 41e2d0964834426db164c5e9b6f5d7a167815173 (diff) |
Correct former completely bogus code. It never worked correctly.
Diffstat (limited to 'sysdeps/libm-ieee754')
-rw-r--r-- | sysdeps/libm-ieee754/s_modfl.c | 19 |
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; } } |