aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib9/fmt/nan64.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/lib9/fmt/nan64.c b/src/lib9/fmt/nan64.c
index 8fad49eb..3a1f2111 100644
--- a/src/lib9/fmt/nan64.c
+++ b/src/lib9/fmt/nan64.c
@@ -31,7 +31,8 @@ __isNaN(double d)
p = &d;
x = *(uvlong*)p;
- return (ulong)((x>>52)&0x7FF)==0x7FF && !__isInf(d, 0);
+ /* IEEE 754: exponent bits 0x7FF and non-zero mantissa */
+ return (x&uvinf) == uvinf && (x&~uvneginf) != 0;
}
double