X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fmath%2F__fpclassifyl.c;h=e4d231b579d7cd7cb961a5e3675324a016f5d6d7;hb=5271ff46b9e983bec5fd9ab79d5aaf096fa54157;hp=a5ad36f2c2196e76a5b0a287b3c759bb298978c7;hpb=b69f695acedd4ce2798ef9ea28d834ceccc789bd;p=musl diff --git a/src/math/__fpclassifyl.c b/src/math/__fpclassifyl.c index a5ad36f2..e4d231b5 100644 --- a/src/math/__fpclassifyl.c +++ b/src/math/__fpclassifyl.c @@ -7,8 +7,11 @@ int __fpclassifyl(long double x) { union ldshape u = { x }; int e = u.bits.exp; - if (!e) - return u.bits.m ? FP_SUBNORMAL : FP_ZERO; + if (!e) { + if (u.bits.m >> 63) return FP_NAN; + else if (u.bits.m) return FP_SUBNORMAL; + else return FP_ZERO; + } if (e == 0x7fff) return u.bits.m & (uint64_t)-1>>1 ? FP_NAN : FP_INFINITE; return u.bits.m & (uint64_t)1<<63 ? FP_NORMAL : FP_NAN;