xref: /netbsd-src/lib/libm/src/s_isinf.c (revision 76dfffe33547c37f8bdd446e3e4ab0f3c16cea4b)
1 /*
2  * Written by J.T. Conklin <jtc@netbsd.org>.
3  * Public domain.
4  */
5 
6 #if defined(LIBM_SCCS) && !defined(lint)
7 static char rcsid[] = "$NetBSD: s_isinf.c,v 1.3 1995/05/11 23:03:44 jtc Exp $";
8 #endif
9 
10 /*
11  * isinf(x) returns 1 is x is inf, else 0;
12  * no branching!
13  */
14 
15 #include "math.h"
16 #include "math_private.h"
17 
18 #ifdef __STDC__
19 	int isinf(double x)
20 #else
21 	int isinf(x)
22 	double x;
23 #endif
24 {
25 	int32_t hx,lx;
26 	EXTRACT_WORDS(hx,lx,x);
27 	hx &= 0x7fffffff;
28 	hx ^= 0x7ff00000;
29 	hx |= lx;
30 	return (hx == 0);
31 }
32