xref: /minix3/lib/libm/src/s_finitef.c (revision 84d9c625bfea59e274550651111ae9edfdc40fbd)
12fe8fb19SBen Gras /* s_finitef.c -- float version of s_finite.c.
22fe8fb19SBen Gras  * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
32fe8fb19SBen Gras  */
42fe8fb19SBen Gras 
52fe8fb19SBen Gras /*
62fe8fb19SBen Gras  * ====================================================
72fe8fb19SBen Gras  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
82fe8fb19SBen Gras  *
92fe8fb19SBen Gras  * Developed at SunPro, a Sun Microsystems, Inc. business.
102fe8fb19SBen Gras  * Permission to use, copy, modify, and distribute this
112fe8fb19SBen Gras  * software is freely granted, provided that this notice
122fe8fb19SBen Gras  * is preserved.
132fe8fb19SBen Gras  * ====================================================
142fe8fb19SBen Gras  */
152fe8fb19SBen Gras 
162fe8fb19SBen Gras #include <sys/cdefs.h>
172fe8fb19SBen Gras #if defined(LIBM_SCCS) && !defined(lint)
18*84d9c625SLionel Sambuc __RCSID("$NetBSD: s_finitef.c,v 1.8 2013/11/12 17:37:43 joerg Exp $");
192fe8fb19SBen Gras #endif
202fe8fb19SBen Gras 
212fe8fb19SBen Gras /*
22*84d9c625SLionel Sambuc  * finitef(x) returns 1 if x is finite, else 0;
232fe8fb19SBen Gras  * no branching!
242fe8fb19SBen Gras  */
252fe8fb19SBen Gras 
262fe8fb19SBen Gras #include "math.h"
272fe8fb19SBen Gras #include "math_private.h"
282fe8fb19SBen Gras 
292fe8fb19SBen Gras int
finitef(float x)302fe8fb19SBen Gras finitef(float x)
312fe8fb19SBen Gras {
322fe8fb19SBen Gras 	int32_t ix;
332fe8fb19SBen Gras 	GET_FLOAT_WORD(ix,x);
342fe8fb19SBen Gras 	return (int)((u_int32_t)((ix&0x7fffffff)-0x7f800000)>>31);
352fe8fb19SBen Gras }
36