X-Git-Url: http://nsz.repo.hu/git/?p=musl;a=blobdiff_plain;f=src%2Fmath%2Flogbl.c;h=f3850745812bcfdc797603502d188bf4245b9c10;hp=5d04abd764404dbb166ae01d18c25cba9b07d679;hb=52bcf3f5fb3251dca4df5b97b01543160340b31b;hpb=b69f695acedd4ce2798ef9ea28d834ceccc789bd diff --git a/src/math/logbl.c b/src/math/logbl.c index 5d04abd7..f3850745 100644 --- a/src/math/logbl.c +++ b/src/math/logbl.c @@ -1,4 +1,3 @@ -#include #include "libm.h" #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 long double logbl(long double x) @@ -8,12 +7,10 @@ long double logbl(long double x) #else long double logbl(long double x) { - int i = ilogbl(x); - - if (i == FP_ILOGB0) - return -1.0/fabsl(x); - if (i == FP_ILOGBNAN || i == INT_MAX) + if (!isfinite(x)) return x * x; - return i; + if (x == 0) + return -1/(x+0); + return ilogbl(x); } #endif