X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;ds=sidebyside;f=src%2Fmath%2Flogbf.c;h=a0a0b5ed5be57de3e3ce05811af631f2ca88898a;hb=b72cd07f176b876aa51864d93aa8101477b1d732;hp=934827f885b7e388eacce766cdd30090fc329487;hpb=b69f695acedd4ce2798ef9ea28d834ceccc789bd;p=musl diff --git a/src/math/logbf.c b/src/math/logbf.c index 934827f8..a0a0b5ed 100644 --- a/src/math/logbf.c +++ b/src/math/logbf.c @@ -1,12 +1,10 @@ -#include -#include "libm.h" +#include -float logbf(float x) { - int i = ilogbf(x); - - if (i == FP_ILOGB0) - return -1.0f/fabsf(x); - if (i == FP_ILOGBNAN || i == INT_MAX) +float logbf(float x) +{ + if (!isfinite(x)) return x * x; - return i; + if (x == 0) + return -1/(x*x); + return ilogbf(x); }