1 /* s_isnanl.c -- long double version of s_isnan.c.
2 */
3
4 /*
5 * ====================================================
6 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
7 *
8 * Developed at SunPro, a Sun Microsystems, Inc. business.
9 * Permission to use, copy, modify, and distribute this
10 * software is freely granted, provided that this notice
11 * is preserved.
12 * ====================================================
13 */
14
15 #if defined(LIBM_SCCS) && !defined(lint)
16 static char rcsid[] = "$NetBSD: $";
17 #endif
18
19 /*
20 * isnanl(x) returns 1 is x is nan, else 0;
21 * no branching!
22 */
23
24 #include <math.h>
25 #include <math_private.h>
26 #include <math_ldbl_opt.h>
27
28 int
___isnanl(long double x)29 ___isnanl (long double x)
30 {
31 uint64_t hx;
32 double xhi;
33
34 xhi = ldbl_high (x);
35 EXTRACT_WORDS64 (hx, xhi);
36 hx &= 0x7fffffffffffffffLL;
37 hx = 0x7ff0000000000000LL - hx;
38 return (int) (hx >> 63);
39 }
40 hidden_ver (___isnanl, __isnanl)
41 #if !IS_IN (libm)
42 weak_alias (___isnanl, ____isnanl)
43 long_double_symbol (libc, ___isnanl, isnanl);
44 long_double_symbol (libc, ____isnanl, __isnanl);
45 #endif
46