Back to index

glibc  2.9
s_isinff.c
Go to the documentation of this file.
00001 /*
00002  * Written by J.T. Conklin <jtc@netbsd.org>.
00003  * Public domain.
00004  */
00005 
00006 #if defined(LIBM_SCCS) && !defined(lint)
00007 static char rcsid[] = "$NetBSD: s_isinff.c,v 1.3 1995/05/11 23:20:21 jtc Exp $";
00008 #endif
00009 
00010 /*
00011  * isinff(x) returns 1 if x is inf, -1 if x is -inf, else 0;
00012  * no branching!
00013  */
00014 
00015 #include "math.h"
00016 #include "math_private.h"
00017 
00018 int
00019 __isinff (float x)
00020 {
00021        int32_t ix,t;
00022        GET_FLOAT_WORD(ix,x);
00023        t = ix & 0x7fffffff;
00024        t ^= 0x7f800000;
00025        t |= -t;
00026        return ~(t >> 31) & (ix >> 30);
00027 }
00028 hidden_def (__isinff)
00029 weak_alias (__isinff, isinff)