Add -gno-strict-dwarf to dg-options in various btf enum tests
[official-gcc.git] / libquadmath / math / logbq.c
bloba1012add4020d9f3e7cd34ff0675f2000b0525a1
1 /* s_logbl.c -- long double version of s_logb.c.
2 * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz.
3 */
5 /*
6 * ====================================================
7 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
9 * Developed at SunPro, a Sun Microsystems, Inc. business.
10 * Permission to use, copy, modify, and distribute this
11 * software is freely granted, provided that this notice
12 * is preserved.
13 * ====================================================
16 #if defined(LIBM_SCCS) && !defined(lint)
17 static char rcsid[] = "$NetBSD: $";
18 #endif
21 * long double logbq(x)
22 * IEEE 754 logb. Included to pass IEEE test suite. Not recommend.
23 * Use ilogb instead.
26 #include "quadmath-imp.h"
28 __float128
29 logbq (__float128 x)
31 int64_t lx, hx, ex;
33 GET_FLT128_WORDS64 (hx, lx, x);
34 hx &= 0x7fffffffffffffffLL; /* high |x| */
35 if ((hx | lx) == 0)
36 return -1.0 / fabsq (x);
37 if (hx >= 0x7fff000000000000LL)
38 return x * x;
39 if ((ex = hx >> 48) == 0) /* IEEE 754 logb */
41 /* POSIX specifies that denormal number is treated as
42 though it were normalized. */
43 int ma;
44 if (hx == 0)
45 ma = __builtin_clzll (lx) + 64;
46 else
47 ma = __builtin_clzll (hx);
48 ex -= ma - 16;
50 return (__float128) (ex - 16383);