Back to index

glibc  2.9
s_isnanl.c
Go to the documentation of this file.
00001 /* s_isnanl.c -- long double version for i387 of s_isnan.c.
00002  * Conversion to long double by Ulrich Drepper,
00003  * Cygnus Support, drepper@cygnus.com.
00004  */
00005 
00006 /*
00007  * ====================================================
00008  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
00009  *
00010  * Developed at SunPro, a Sun Microsystems, Inc. business.
00011  * Permission to use, copy, modify, and distribute this
00012  * software is freely granted, provided that this notice
00013  * is preserved.
00014  * ====================================================
00015  */
00016 
00017 #if defined(LIBM_SCCS) && !defined(lint)
00018 static char rcsid[] = "$NetBSD: $";
00019 #endif
00020 
00021 /*
00022  * isnanl(x) returns 1 is x is nan, else 0;
00023  * no branching!
00024  */
00025 
00026 #include "math.h"
00027 #include "math_private.h"
00028 
00029 #ifdef __STDC__
00030        int __isnanl(long double x)
00031 #else
00032        int __isnanl(x)
00033        long double x;
00034 #endif
00035 {
00036        int32_t se,hx,lx;
00037        GET_LDOUBLE_WORDS(se,hx,lx,x);
00038        se = (se & 0x7fff) << 1;
00039        /* The additional & 0x7fffffff is required because Intel's
00040           extended format has the normally implicit 1 explicit
00041           present.  Sigh!  */
00042        lx |= hx & 0x7fffffff;
00043        se |= (u_int32_t)(lx|(-lx))>>31;
00044        se = 0xfffe - se;
00045        return (int)((u_int32_t)(se))>>16;
00046 }
00047 hidden_def (__isnanl)
00048 weak_alias (__isnanl, isnanl)