1 | /* s_isnanl.c -- long double version for i387 of s_isnan.c. |
2 | * Conversion to long double by Ulrich Drepper, |
3 | * Cygnus Support, drepper@cygnus.com. |
4 | */ |
5 | |
6 | /* |
7 | * ==================================================== |
8 | * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. |
9 | * |
10 | * Developed at SunPro, a Sun Microsystems, Inc. business. |
11 | * Permission to use, copy, modify, and distribute this |
12 | * software is freely granted, provided that this notice |
13 | * is preserved. |
14 | * ==================================================== |
15 | */ |
16 | |
17 | #if defined(LIBM_SCCS) && !defined(lint) |
18 | static char rcsid[] = "$NetBSD: $" ; |
19 | #endif |
20 | |
21 | /* |
22 | * isnanl(x) returns 1 is x is nan, else 0; |
23 | * no branching! |
24 | */ |
25 | |
26 | #include <math.h> |
27 | #include <math_private.h> |
28 | |
29 | int __isnanl(long double x) |
30 | { |
31 | int32_t se,hx,lx,pn; |
32 | GET_LDOUBLE_WORDS(se,hx,lx,x); |
33 | se = (se & 0x7fff) << 1; |
34 | /* Detect pseudo-normal numbers, i.e. exponent is non-zero and the top |
35 | bit of the significand is not set. */ |
36 | pn = (uint32_t)((~hx & 0x80000000) & (se|(-se)))>>31; |
37 | /* Clear the significand bit when computing mantissa. */ |
38 | lx |= hx & 0x7fffffff; |
39 | se |= (uint32_t)(lx|(-lx))>>31; |
40 | se = 0xfffe - se; |
41 | |
42 | return (int)(((uint32_t)(se)) >> 16) | pn; |
43 | } |
44 | hidden_def (__isnanl) |
45 | weak_alias (__isnanl, isnanl) |
46 | |