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 #include <ieeefp.h>
21
22 #ifdef _NEED_FLOAT64
23
24 #undef isinf
25
26 int
isinf64(__float64 x)27 isinf64(__float64 x)
28 {
29 __int32_t hx,lx;
30 EXTRACT_WORDS(hx,lx,x);
31 hx &= 0x7fffffff;
32 hx |= (__uint32_t)(lx|(-lx))>>31;
33 hx = 0x7ff00000 - hx;
34 return 1 - (int)((__uint32_t)(hx|(-hx))>>31);
35 }
36
37 _MATH_ALIAS_i_d(isinf)
38
39 #endif /* _NEED_FLOAT64 */
40