mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-27 11:52:03 +00:00
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
|
||||
__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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue