summaryrefslogtreecommitdiff
path: root/sysdeps/libm-ieee754/s_modfl.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/libm-ieee754/s_modfl.c')
-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;
}
}