initial cmath code and minor libm.h update
[libm] / src / math / __fpclassify.c
1 #include "libm.h"
2
3 int __fpclassify(double x)
4 {
5         union dshape u = { x };
6         int e = u.bits>>52 & 0x7ff;
7         if (!e) return u.bits<<1 ? FP_SUBNORMAL : FP_ZERO;
8         if (e==0x7ff) return u.bits<<12 ? FP_NAN : FP_INFINITE;
9         return FP_NORMAL;
10 }