From 9fa229fc8d732540b7057e8f8a7cdf2b8653d769 Mon Sep 17 00:00:00 2001 From: David Schultz Date: Sat, 6 Jan 2007 21:22:38 +0000 Subject: [PATCH] Correctly handle inf/nan. This routine is currently unused because we seem to have assembly versions for all architectures, but it can't hurt to fix it. --- lib/msun/src/s_modf.c | 4 ++++ 1 file changed, 4 insertions(+) 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 */