__fpclassify.c 259 B

1234567891011
  1. #include <math.h>
  2. #include <stdint.h>
  3. int __fpclassifyd(double x)
  4. {
  5. union {double f; uint64_t i;} u = {x};
  6. int e = u.i>>52 & 0x7ff;
  7. if (!e) return u.i<<1 ? FP_SUBNORMAL : FP_ZERO;
  8. if (e==0x7ff) return u.i<<12 ? FP_NAN : FP_INFINITE;
  9. return FP_NORMAL;
  10. }