From ada7ea055b221d489ebfbf2b2900b4e39f3fd043 Mon Sep 17 00:00:00 2001 From: rsc Date: Fri, 6 Apr 2007 13:27:55 +0000 Subject: another day, another __isNaN --- src/lib9/fmt/nan64.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') 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 -- cgit v1.2.3