loongarch64: add new syscall numbers
[musl.git] / src / math / __fpclassify.c
blobf7c0e2dfac828616b43f76664c6821de1b348f8d
1 #include <math.h>
2 #include <stdint.h>
4 int __fpclassify(double x)
6 union {double f; uint64_t i;} u = {x};
7 int e = u.i>>52 & 0x7ff;
8 if (!e) return u.i<<1 ? FP_SUBNORMAL : FP_ZERO;
9 if (e==0x7ff) return u.i<<12 ? FP_NAN : FP_INFINITE;
10 return FP_NORMAL;