ldso: correct condition for local symbol handling in do_relocs
[musl.git] / src / math / __fpclassifyl.c
blobe41781b689af7f7db420fc437cc4a72e4dd00c33
1 #include "libm.h"
3 #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
4 int __fpclassifyl(long double x)
6 return __fpclassify(x);
8 #elif LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384
9 int __fpclassifyl(long double x)
11 union ldshape u = {x};
12 int e = u.i.se & 0x7fff;
13 int msb = u.i.m>>63;
14 if (!e && !msb)
15 return u.i.m ? FP_SUBNORMAL : FP_ZERO;
16 if (e == 0x7fff) {
17 /* The x86 variant of 80-bit extended precision only admits
18 * one representation of each infinity, with the mantissa msb
19 * necessarily set. The version with it clear is invalid/nan.
20 * The m68k variant, however, allows either, and tooling uses
21 * the version with it clear. */
22 if (__BYTE_ORDER == __LITTLE_ENDIAN && !msb)
23 return FP_NAN;
24 return u.i.m << 1 ? FP_NAN : FP_INFINITE;
26 if (!msb)
27 return FP_NAN;
28 return FP_NORMAL;
30 #elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384
31 int __fpclassifyl(long double x)
33 union ldshape u = {x};
34 int e = u.i.se & 0x7fff;
35 u.i.se = 0;
36 if (!e)
37 return u.i2.lo | u.i2.hi ? FP_SUBNORMAL : FP_ZERO;
38 if (e == 0x7fff)
39 return u.i2.lo | u.i2.hi ? FP_NAN : FP_INFINITE;
40 return FP_NORMAL;
42 #endif