xref: /netbsd-src/lib/libm/src/s_isinf.c (revision 99410184e77999def7f79bcb565a0342c7911c98)
1d797a5d5Sjtc /*
2*99410184Ssalo  * Written by J.T. Conklin <jtc@NetBSD.org>.
39ae90685Sjtc  * Public domain.
4d797a5d5Sjtc  */
5d797a5d5Sjtc 
661187201Slukem #include <sys/cdefs.h>
7d797a5d5Sjtc #if defined(LIBM_SCCS) && !defined(lint)
8*99410184Ssalo __RCSID("$NetBSD: s_isinf.c,v 1.6 2003/07/26 19:25:05 salo Exp $");
9d797a5d5Sjtc #endif
10d797a5d5Sjtc 
11d797a5d5Sjtc /*
12d797a5d5Sjtc  * isinf(x) returns 1 is x is inf, else 0;
13d797a5d5Sjtc  * no branching!
14d797a5d5Sjtc  */
15d797a5d5Sjtc 
16d797a5d5Sjtc #include "math.h"
17d797a5d5Sjtc #include "math_private.h"
18d797a5d5Sjtc 
19aa30599eSwiz int
isinf(double x)20aa30599eSwiz isinf(double x)
21d797a5d5Sjtc {
22d797a5d5Sjtc 	int32_t hx,lx;
23d797a5d5Sjtc 	EXTRACT_WORDS(hx,lx,x);
24d797a5d5Sjtc 	hx &= 0x7fffffff;
25d797a5d5Sjtc 	hx ^= 0x7ff00000;
26d797a5d5Sjtc 	hx |= lx;
27d797a5d5Sjtc 	return (hx == 0);
28d797a5d5Sjtc }
29