This work is based in part on code from NetBSD libm, libc and kernel. The library is partly public domain and partly BSD-style licensed.
29 lines
457 B
C
29 lines
457 B
C
/*
|
|
* Written by J.T. Conklin <jtc@NetBSD.org>.
|
|
* Public domain.
|
|
*/
|
|
|
|
#include <sys/cdefs.h>
|
|
#if defined(LIBM_SCCS) && !defined(lint)
|
|
__RCSID("$NetBSD: s_isinf.c,v 1.6 2003/07/26 19:25:05 salo Exp $");
|
|
#endif
|
|
|
|
/*
|
|
* isinf(x) returns 1 is x is inf, else 0;
|
|
* no branching!
|
|
*/
|
|
|
|
#include "math.h"
|
|
#include "math_private.h"
|
|
|
|
int
|
|
isinf(double x)
|
|
{
|
|
int32_t hx,lx;
|
|
EXTRACT_WORDS(hx,lx,x);
|
|
hx &= 0x7fffffff;
|
|
hx ^= 0x7ff00000;
|
|
hx |= lx;
|
|
return (hx == 0);
|
|
}
|