4f93bef17f6e46c821ba882241303257bf6e0637
[musl] / src / math / __fpclassifyl.c
1 #include <stdint.h>
2 #include <math.h>
3
4 /* FIXME: move this to arch-specific file */
5 int __fpclassifyl(long double __x)
6 {
7         union {
8                 long double __ld;
9                 __uint16_t __hw[5];
10                 __uint64_t __m;
11         } __y = { __x };
12         int __ee = __y.__hw[4]&0x7fff;
13         if (!__ee) return __y.__m ? FP_SUBNORMAL : FP_ZERO;
14         if (__ee==0x7fff) return __y.__m ? FP_NAN : FP_INFINITE;
15         return FP_NORMAL;
16 }