summaryrefslogtreecommitdiff
path: root/src/math/log2.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2012-03-19 22:07:43 -0400
committerRich Felker <dalias@aerifal.cx>2012-03-19 22:07:43 -0400
commit97721a5508415a2f10eb068e022093811c9ff8be (patch)
tree88e9ce153895ad949576fa7ce1eeee4b02286479 /src/math/log2.c
parentacb744921b73f5a73803e533e5e4a4896d164a26 (diff)
parent0cbb65479147ecdaa664e88cc2a5a925f3de502f (diff)
downloadmusl-97721a5508415a2f10eb068e022093811c9ff8be.tar.gz
Merge remote branch 'nsz/master'
Diffstat (limited to 'src/math/log2.c')
-rw-r--r--src/math/log2.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/math/log2.c b/src/math/log2.c
index a5b8abdd..1974215d 100644
--- a/src/math/log2.c
+++ b/src/math/log2.c
@@ -27,8 +27,6 @@ two54 = 1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */
ivln2hi = 1.44269504072144627571e+00, /* 0x3ff71547, 0x65200000 */
ivln2lo = 1.67517131648865118353e-10; /* 0x3de705fc, 0x2eefa200 */
-static const double zero = 0.0;
-
double log2(double x)
{
double f,hfsq,hi,lo,r,val_hi,val_lo,w,y;
@@ -40,9 +38,9 @@ double log2(double x)
k = 0;
if (hx < 0x00100000) { /* x < 2**-1022 */
if (((hx&0x7fffffff)|lx) == 0)
- return -two54/zero; /* log(+-0)=-inf */
+ return -two54/0.0; /* log(+-0)=-inf */
if (hx < 0)
- return (x-x)/zero; /* log(-#) = NaN */
+ return (x-x)/0.0; /* log(-#) = NaN */
/* subnormal number, scale up x */
k -= 54;
x *= two54;
@@ -51,7 +49,7 @@ double log2(double x)
if (hx >= 0x7ff00000)
return x+x;
if (hx == 0x3ff00000 && lx == 0)
- return zero; /* log(1) = +0 */
+ return 0.0; /* log(1) = +0 */
k += (hx>>20) - 1023;
hx &= 0x000fffff;
i = (hx+0x95f64) & 0x100000;