12116Sjkh/* @(#)s_finite.c 5.1 93/09/24 */
22116Sjkh/*
32116Sjkh * ====================================================
42116Sjkh * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
52116Sjkh *
62116Sjkh * Developed at SunPro, a Sun Microsystems, Inc. business.
72116Sjkh * Permission to use, copy, modify, and distribute this
88870Srgrimes * software is freely granted, provided that this notice
92116Sjkh * is preserved.
102116Sjkh * ====================================================
112116Sjkh */
122116Sjkh
13176451Sdas#include <sys/cdefs.h>
14176451Sdas__FBSDID("$FreeBSD$");
152116Sjkh
162116Sjkh/*
172116Sjkh * finite(x) returns 1 is x is finite, else 0;
182116Sjkh * no branching!
192116Sjkh */
202116Sjkh
212116Sjkh#include "math.h"
222116Sjkh#include "math_private.h"
232116Sjkh
24117912Speter	int finite(double x)
252116Sjkh{
262116Sjkh	int32_t hx;
272116Sjkh	GET_HIGH_WORD(hx,x);
282116Sjkh	return (int)((u_int32_t)((hx&0x7fffffff)-0x7ff00000)>>31);
292116Sjkh}
30