Back to index

glibc  2.9
s_finite.c
Go to the documentation of this file.
00001 /* @(#)s_finite.c 5.1 93/09/24 */
00002 /*
00003  * ====================================================
00004  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
00005  *
00006  * Developed at SunPro, a Sun Microsystems, Inc. business.
00007  * Permission to use, copy, modify, and distribute this
00008  * software is freely granted, provided that this notice
00009  * is preserved.
00010  * ====================================================
00011  */
00012 
00013 #if defined(LIBM_SCCS) && !defined(lint)
00014 static char rcsid[] = "$NetBSD: s_finite.c,v 1.8 1995/05/10 20:47:17 jtc Exp $";
00015 #endif
00016 
00017 /*
00018  * finite(x) returns 1 is x is finite, else 0;
00019  * no branching!
00020  */
00021 
00022 #include "math.h"
00023 #include "math_private.h"
00024 
00025 #ifdef __STDC__
00026        int __finite(double x)
00027 #else
00028        int __finite(x)
00029        double x;
00030 #endif
00031 {
00032        int32_t hx;
00033        GET_HIGH_WORD(hx,x);
00034        return (int)((u_int32_t)((hx&0x7fffffff)-0x7ff00000)>>31);
00035 }
00036 hidden_def (__finite)
00037 weak_alias (__finite, finite)
00038 #ifdef NO_LONG_DOUBLE
00039 strong_alias (__finite, __finitel)
00040 weak_alias (__finite, finitel)
00041 #endif