1*901f3990SIngo Weinhold /* s_isnanl.c -- long double version for i387 of s_isnan.c. 2*901f3990SIngo Weinhold * Conversion to long double by Ulrich Drepper, 3*901f3990SIngo Weinhold * Cygnus Support, drepper@cygnus.com. 4*901f3990SIngo Weinhold */ 5*901f3990SIngo Weinhold 6*901f3990SIngo Weinhold /* 7*901f3990SIngo Weinhold * ==================================================== 8*901f3990SIngo Weinhold * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. 9*901f3990SIngo Weinhold * 10*901f3990SIngo Weinhold * Developed at SunPro, a Sun Microsystems, Inc. business. 11*901f3990SIngo Weinhold * Permission to use, copy, modify, and distribute this 12*901f3990SIngo Weinhold * software is freely granted, provided that this notice 13*901f3990SIngo Weinhold * is preserved. 14*901f3990SIngo Weinhold * ==================================================== 15*901f3990SIngo Weinhold */ 16*901f3990SIngo Weinhold 17*901f3990SIngo Weinhold #if defined(LIBM_SCCS) && !defined(lint) 18*901f3990SIngo Weinhold static char rcsid[] = "$NetBSD: $"; 19*901f3990SIngo Weinhold #endif 20*901f3990SIngo Weinhold 21*901f3990SIngo Weinhold /* 22*901f3990SIngo Weinhold * isnanl(x) returns 1 is x is nan, else 0; 23*901f3990SIngo Weinhold * no branching! 24*901f3990SIngo Weinhold */ 25*901f3990SIngo Weinhold 26*901f3990SIngo Weinhold #include "math.h" 27*901f3990SIngo Weinhold #include "math_private.h" 28*901f3990SIngo Weinhold 29*901f3990SIngo Weinhold #ifdef __STDC__ __isnanl(long double x)30*901f3990SIngo Weinhold int __isnanl(long double x) 31*901f3990SIngo Weinhold #else 32*901f3990SIngo Weinhold int __isnanl(x) 33*901f3990SIngo Weinhold long double x; 34*901f3990SIngo Weinhold #endif 35*901f3990SIngo Weinhold { 36*901f3990SIngo Weinhold int32_t se,hx,lx; 37*901f3990SIngo Weinhold GET_LDOUBLE_WORDS(se,hx,lx,x); 38*901f3990SIngo Weinhold se = (se & 0x7fff) << 1; 39*901f3990SIngo Weinhold /* The additional & 0x7fffffff is required because Intel's 40*901f3990SIngo Weinhold extended format has the normally implicit 1 explicit 41*901f3990SIngo Weinhold present. Sigh! */ 42*901f3990SIngo Weinhold lx |= hx & 0x7fffffff; 43*901f3990SIngo Weinhold se |= (u_int32_t)(lx|(-lx))>>31; 44*901f3990SIngo Weinhold se = 0xfffe - se; 45*901f3990SIngo Weinhold return (int)((u_int32_t)(se))>>16; 46*901f3990SIngo Weinhold } 47*901f3990SIngo Weinhold hidden_def (__isnanl) 48*901f3990SIngo Weinhold weak_alias (__isnanl, isnanl) 49