s_finite.c revision 8870
114825Swollman/* @(#)s_finite.c 5.1 93/09/24 */
214825Swollman/*
314825Swollman * ====================================================
414825Swollman * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
514825Swollman *
614825Swollman * Developed at SunPro, a Sun Microsystems, Inc. business.
714825Swollman * Permission to use, copy, modify, and distribute this
814825Swollman * software is freely granted, provided that this notice
914825Swollman * is preserved.
1014825Swollman * ====================================================
1114825Swollman */
1214825Swollman
1314825Swollman#ifndef lint
1414825Swollmanstatic char rcsid[] = "$Id: s_finite.c,v 1.1.1.1 1994/08/19 09:39:51 jkh Exp $";
1514825Swollman#endif
1614825Swollman
1714825Swollman/*
1814825Swollman * finite(x) returns 1 is x is finite, else 0;
1914825Swollman * no branching!
2014825Swollman */
2114825Swollman
2214825Swollman#include "math.h"
2314825Swollman#include "math_private.h"
2414825Swollman
2514825Swollman#ifdef __STDC__
2614825Swollman	int finite(double x)
2714825Swollman#else
2814825Swollman	int finite(x)
2950477Speter	double x;
3014825Swollman#endif
3114825Swollman{
3214825Swollman	int32_t hx;
3314825Swollman	GET_HIGH_WORD(hx,x);
3414825Swollman	return (int)((u_int32_t)((hx&0x7fffffff)-0x7ff00000)>>31);
3514825Swollman}
3614825Swollman