1 #include "libm.h" 2 3 #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 __fpclassifyl(long double x)4int __fpclassifyl(long double x) 5 { 6 return __fpclassify(x); 7 } 8 #elif LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384 __fpclassifyl(long double x)9int __fpclassifyl(long double x) 10 { 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; 25 } 26 if (!msb) 27 return FP_NAN; 28 return FP_NORMAL; 29 } 30 #elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384 __fpclassifyl(long double x)31int __fpclassifyl(long double x) 32 { 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; 41 } 42 #endif 43