From 98be442ee8a2b8b7e0802b604e384d5a2c43282e Mon Sep 17 00:00:00 2001 From: Szabolcs Nagy Date: Mon, 2 Sep 2013 23:35:46 +0000 Subject: 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 --- src/math/logb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/math/logb.c') 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 /* 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); } -- cgit v1.2.1