summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Evans <bde@FreeBSD.org>2007-06-14 06:08:38 +0000
committerBruce Evans <bde@FreeBSD.org>2007-06-14 06:08:38 +0000
commit7facca2092a57331371c494413391dd62cc4a19c (patch)
tree25194f246cb4ee2bb85605d10db76497eb8b8ccb
parent51645f1800e4b6b10179710e5746f44a93e2cebc (diff)
Notes
-rw-r--r--lib/msun/src/s_modf.c4
-rw-r--r--lib/msun/src/s_modff.c2
2 files changed, 6 insertions, 0 deletions
diff --git a/lib/msun/src/s_modf.c b/lib/msun/src/s_modf.c
index 8cfe56884a01..ab13191b9004 100644
--- a/lib/msun/src/s_modf.c
+++ b/lib/msun/src/s_modf.c
@@ -55,6 +55,10 @@ modf(double x, double *iptr)
}
} else if (j0>51) { /* no fraction part */
u_int32_t high;
+ if (j0 == 0x400) { /* inf/NaN */
+ *iptr = x;
+ return 0.0 / x;
+ }
*iptr = x*one;
GET_HIGH_WORD(high,x);
INSERT_WORDS(x,high&0x80000000,0); /* return +-0 */
diff --git a/lib/msun/src/s_modff.c b/lib/msun/src/s_modff.c
index 69b64e901cf9..4436764ecb24 100644
--- a/lib/msun/src/s_modff.c
+++ b/lib/msun/src/s_modff.c
@@ -49,6 +49,8 @@ modff(float x, float *iptr)
} else { /* no fraction part */
u_int32_t ix;
*iptr = x*one;
+ if (x != x) /* NaN */
+ return x;
GET_FLOAT_WORD(ix,x);
SET_FLOAT_WORD(x,ix&0x80000000); /* return +-0 */
return x;