diff options
author | rsc <devnull@localhost> | 2007-05-10 04:18:22 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2007-05-10 04:18:22 +0000 |
commit | 35920e96a1bd6dcc5c803582ce9568c2f0a4fdc1 (patch) | |
tree | 8ef3e0dc499dd377456acd95cf50e4629afb0f4f /src/lib9 | |
parent | e54f9a4ad2f163f9455f3de4b3e5574884391790 (diff) | |
download | plan9port-35920e96a1bd6dcc5c803582ce9568c2f0a4fdc1.tar.gz plan9port-35920e96a1bd6dcc5c803582ce9568c2f0a4fdc1.tar.bz2 plan9port-35920e96a1bd6dcc5c803582ce9568c2f0a4fdc1.zip |
fix nan64
Diffstat (limited to 'src/lib9')
-rw-r--r-- | src/lib9/fmt/nan64.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/lib9/fmt/nan64.c b/src/lib9/fmt/nan64.c index 3a1f2111..7d719157 100644 --- a/src/lib9/fmt/nan64.c +++ b/src/lib9/fmt/nan64.c @@ -26,11 +26,18 @@ __NaN(void) int __isNaN(double d) { + /* + * Used to just say x = *(uvlong*)&d, + * but gcc miscompiles that! + */ + union { + uvlong i; + double f; + } u; uvlong x; - double *p; - - p = &d; - x = *(uvlong*)p; + + u.f = d; + x = u.i; /* IEEE 754: exponent bits 0x7FF and non-zero mantissa */ return (x&uvinf) == uvinf && (x&~uvneginf) != 0; } |