1570af302Sopenharmony_ci#include <math.h> 2570af302Sopenharmony_ci#include <stdint.h> 3570af302Sopenharmony_ci 4570af302Sopenharmony_ciint __fpclassify(double x) 5570af302Sopenharmony_ci{ 6570af302Sopenharmony_ci union {double f; uint64_t i;} u = {x}; 7570af302Sopenharmony_ci int e = u.i>>52 & 0x7ff; 8570af302Sopenharmony_ci if (!e) return u.i<<1 ? FP_SUBNORMAL : FP_ZERO; 9570af302Sopenharmony_ci if (e==0x7ff) return u.i<<12 ? FP_NAN : FP_INFINITE; 10570af302Sopenharmony_ci return FP_NORMAL; 11570af302Sopenharmony_ci} 12