diff options
author | Szabolcs Nagy <nsz@port70.net> | 2013-09-02 23:35:46 +0000 |
---|---|---|
committer | Szabolcs Nagy <nsz@port70.net> | 2013-09-05 11:30:07 +0000 |
commit | 98be442ee8a2b8b7e0802b604e384d5a2c43282e (patch) | |
tree | fe20ecbce7be9e457fd678a4e4cea6b0fe32e692 /src/math | |
parent | 4cec31fc23b28271a2ed0b290e65699dffac3fee (diff) | |
download | musl-98be442ee8a2b8b7e0802b604e384d5a2c43282e.tar.gz musl-98be442ee8a2b8b7e0802b604e384d5a2c43282e.tar.bz2 musl-98be442ee8a2b8b7e0802b604e384d5a2c43282e.tar.xz musl-98be442ee8a2b8b7e0802b604e384d5a2c43282e.zip |
math: fix logb(-0.0) in downward rounding mode
use -1/(x*x) instead of -1/(x+0) to return -inf, -0+0 is -0 in
downward rounding mode
Diffstat (limited to 'src/math')
-rw-r--r-- | src/math/logb.c | 4 | ||||
-rw-r--r-- | src/math/logbf.c | 4 | ||||
-rw-r--r-- | src/math/logbl.c | 4 |
3 files changed, 6 insertions, 6 deletions
diff --git a/src/math/logb.c b/src/math/logb.c index 624425a8..7f8bdfae 100644 --- a/src/math/logb.c +++ b/src/math/logb.c @@ -1,4 +1,4 @@ -#include "libm.h" +#include <math.h> /* special cases: @@ -12,6 +12,6 @@ double logb(double x) if (!isfinite(x)) return x * x; if (x == 0) - return -1/(x+0); + return -1/(x*x); return ilogb(x); } diff --git a/src/math/logbf.c b/src/math/logbf.c index 950d3569..a0a0b5ed 100644 --- a/src/math/logbf.c +++ b/src/math/logbf.c @@ -1,10 +1,10 @@ -#include "libm.h" +#include <math.h> float logbf(float x) { if (!isfinite(x)) return x * x; if (x == 0) - return -1/(x+0); + return -1/(x*x); return ilogbf(x); } diff --git a/src/math/logbl.c b/src/math/logbl.c index f3850745..962973a7 100644 --- a/src/math/logbl.c +++ b/src/math/logbl.c @@ -1,4 +1,4 @@ -#include "libm.h" +#include <math.h> #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 long double logbl(long double x) { @@ -10,7 +10,7 @@ long double logbl(long double x) if (!isfinite(x)) return x * x; if (x == 0) - return -1/(x+0); + return -1/(x*x); return ilogbl(x); } #endif |