fix nan64

This commit is contained in:
rsc 2007-05-10 04:18:22 +00:00
parent e54f9a4ad2
commit 35920e96a1

View file

@ -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;
}