initial check-in, version 0.5.0
[musl] / src / math / __fpclassify.c
1 #include <stdint.h>
2 #include <math.h>
3
4 int __fpclassify(double __x)
5 {
6         union {
7                 double __d;
8                 __uint64_t __i;
9         } __y = { __x };
10         int __ee = __y.__i>>52 & 0x7ff;
11         if (!__ee) return __y.__i<<1 ? FP_SUBNORMAL : FP_ZERO;
12         if (__ee==0x7ff) return __y.__i<<12 ? FP_NAN : FP_INFINITE;
13         return FP_NORMAL;
14 }