s_finite.c revision 2116
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
82116Sjkh * software is freely granted, provided that this notice
92116Sjkh * is preserved.
102116Sjkh * ====================================================
112116Sjkh */
122116Sjkh
132116Sjkh#ifndef lint
142116Sjkhstatic char rcsid[] = "$Id: s_finite.c,v 1.6 1994/08/18 23:06:44 jtc Exp $";
152116Sjkh#endif
162116Sjkh
172116Sjkh/*
182116Sjkh * finite(x) returns 1 is x is finite, else 0;
192116Sjkh * no branching!
202116Sjkh */
212116Sjkh
222116Sjkh#include "math.h"
232116Sjkh#include "math_private.h"
242116Sjkh
252116Sjkh#ifdef __STDC__
262116Sjkh	int finite(double x)
272116Sjkh#else
282116Sjkh	int finite(x)
292116Sjkh	double x;
302116Sjkh#endif
312116Sjkh{
322116Sjkh	int32_t hx;
332116Sjkh	GET_HIGH_WORD(hx,x);
342116Sjkh	return (int)((u_int32_t)((hx&0x7fffffff)-0x7ff00000)>>31);
352116Sjkh}
36