1 /*
2 Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
3
4 Developed at SunPro, a Sun Microsystems, Inc. business.
5 Permission to use, copy, modify, and distribute this
6 software is freely granted, provided that this notice
7 is preserved.
8 */
9 /*
10 * isinf(x) returns 1 if x is infinity, else 0;
11 * no branching!
12 *
13 * isinf is a <math.h> macro in the C99 standard. It was previously
14 * implemented as a function by newlib and is declared as such in
15 * <math.h>. Newlib supplies it here as a function if the user
16 * chooses to use it instead of the C99 macro.
17 */
18
19 #include "fdlibm.h"
20
21 #ifdef _NEED_FLOAT64
22
23 #undef isinf
24
25 int
isinf64(__float64 x)26 isinf64(__float64 x)
27 {
28 __int32_t hx,lx;
29 EXTRACT_WORDS(hx,lx,x);
30 hx &= 0x7fffffff;
31 hx |= (__uint32_t)(lx|(-lx))>>31;
32 hx = 0x7ff00000 - hx;
33 return 1 - (int)((__uint32_t)(hx|(-hx))>>31);
34 }
35
36 _MATH_ALIAS_i_d(isinf)
37
38 #endif /* _NEED_FLOAT64 */
39