fix nan64
This commit is contained in:
parent
e54f9a4ad2
commit
35920e96a1
1 changed files with 11 additions and 4 deletions
|
|
@ -26,11 +26,18 @@ __NaN(void)
|
||||||
int
|
int
|
||||||
__isNaN(double d)
|
__isNaN(double d)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
* Used to just say x = *(uvlong*)&d,
|
||||||
|
* but gcc miscompiles that!
|
||||||
|
*/
|
||||||
|
union {
|
||||||
|
uvlong i;
|
||||||
|
double f;
|
||||||
|
} u;
|
||||||
uvlong x;
|
uvlong x;
|
||||||
double *p;
|
|
||||||
|
u.f = d;
|
||||||
p = &d;
|
x = u.i;
|
||||||
x = *(uvlong*)p;
|
|
||||||
/* IEEE 754: exponent bits 0x7FF and non-zero mantissa */
|
/* IEEE 754: exponent bits 0x7FF and non-zero mantissa */
|
||||||
return (x&uvinf) == uvinf && (x&~uvneginf) != 0;
|
return (x&uvinf) == uvinf && (x&~uvneginf) != 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue