Back to index

glibc  2.9
s_isnanl.c
Go to the documentation of this file.
00001 /* s_isnanl.c -- long double version of s_isnan.c.
00002  * Conversion to long double by Jakub Jelinek, jj@ultra.linux.cz.
00003  */
00004 
00005 /*
00006  * ====================================================
00007  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
00008  *
00009  * Developed at SunPro, a Sun Microsystems, Inc. business.
00010  * Permission to use, copy, modify, and distribute this
00011  * software is freely granted, provided that this notice
00012  * is preserved.
00013  * ====================================================
00014  */
00015 
00016 #if defined(LIBM_SCCS) && !defined(lint)
00017 static char rcsid[] = "$NetBSD: $";
00018 #endif
00019 
00020 /*
00021  * isnanl(x) returns 1 is x is nan, else 0;
00022  * no branching!
00023  */
00024 
00025 #include "math.h"
00026 #include "math_private.h"
00027 
00028 #ifdef __STDC__
00029        int __isnanl(long double x)
00030 #else
00031        int __isnanl(x)
00032        long double x;
00033 #endif
00034 {
00035        int64_t hx,lx;
00036        GET_LDOUBLE_WORDS64(hx,lx,x);
00037        hx &= 0x7fffffffffffffffLL;
00038        hx |= (u_int64_t)(lx|(-lx))>>63;
00039        hx = 0x7fff000000000000LL - hx;
00040        return (int)((u_int64_t)hx>>63);
00041 }
00042 hidden_def (__isnanl)
00043 weak_alias (__isnanl, isnanl)