2
* The authors of this software are Rob Pike and Ken Thompson,
3
* with contributions from Mike Burrows and Sean Dorward.
5
* Copyright (c) 2002-2006 by Lucent Technologies.
6
* Portions Copyright (c) 2004 Google Inc.
8
* Permission to use, copy, modify, and distribute this software for any
9
* purpose without fee is hereby granted, provided that this entire notice
10
* is included in all copies of any software which is or includes a copy
11
* or modification of this software and in all copies of the supporting
12
* documentation for such software.
13
* THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
14
* WARRANTY. IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES
15
* NOR GOOGLE INC MAKE ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING
16
* THE MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
20
* 64-bit IEEE not-a-number routines.
21
* This is big/little-endian portable assuming that
22
* the 64-bit doubles and 64-bit integers have the
30
static uvlong uvnan = ((uvlong)0x7FF00000<<32)|0x00000001;
31
static uvlong uvinf = ((uvlong)0x7FF00000<<32)|0x00000000;
32
static uvlong uvneginf = ((uvlong)0xFFF00000<<32)|0x00000000;
34
/* gcc sees through the obvious casts. */
42
assert(sizeof(u.d) == sizeof(u.v));
54
assert(sizeof(u.d) == sizeof(u.v));
71
/* IEEE 754: exponent bits 0x7FF and non-zero mantissa */
72
return (x&uvinf) == uvinf && (x&~uvneginf) != 0;
78
return u2d(sign < 0 ? uvneginf : uvinf);
82
__isInf(double d, int sign)
88
return x==uvinf || x==uvneginf;