summaryrefslogtreecommitdiff
path: root/src/math/log2f.c
diff options
context:
space:
mode:
authornsz <nsz@port70.net>2012-03-19 23:41:19 +0100
committernsz <nsz@port70.net>2012-03-19 23:41:19 +0100
commit0cbb65479147ecdaa664e88cc2a5a925f3de502f (patch)
tree7b6dc53fcec6497d55746d3cc47f167a20b7aa57 /src/math/log2f.c
parentb03255af77776703c8d48819e824d09f6f54ba86 (diff)
downloadmusl-0cbb65479147ecdaa664e88cc2a5a925f3de502f.tar.gz
musl-0cbb65479147ecdaa664e88cc2a5a925f3de502f.tar.bz2
musl-0cbb65479147ecdaa664e88cc2a5a925f3de502f.tar.xz
musl-0cbb65479147ecdaa664e88cc2a5a925f3de502f.zip
code cleanup of named constants
zero, one, two, half are replaced by const literals The policy was to use the f suffix for float consts (1.0f), but don't use suffix for long double consts (these consts can be exactly represented as double).
Diffstat (limited to 'src/math/log2f.c')
-rw-r--r--src/math/log2f.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/math/log2f.c b/src/math/log2f.c
index c9b9282c..e0d6a9e4 100644
--- a/src/math/log2f.c
+++ b/src/math/log2f.c
@@ -21,8 +21,6 @@ two25 = 3.3554432000e+07, /* 0x4c000000 */
ivln2hi = 1.4428710938e+00, /* 0x3fb8b000 */
ivln2lo = -1.7605285393e-04; /* 0xb9389ad4 */
-static const float zero = 0.0;
-
float log2f(float x)
{
float f,hfsq,hi,lo,r,y;
@@ -33,9 +31,9 @@ float log2f(float x)
k = 0;
if (hx < 0x00800000) { /* x < 2**-126 */
if ((hx&0x7fffffff) == 0)
- return -two25/zero; /* log(+-0)=-inf */
+ return -two25/0.0f; /* log(+-0)=-inf */
if (hx < 0)
- return (x-x)/zero; /* log(-#) = NaN */
+ return (x-x)/0.0f; /* log(-#) = NaN */
/* subnormal number, scale up x */
k -= 25;
x *= two25;
@@ -44,7 +42,7 @@ float log2f(float x)
if (hx >= 0x7f800000)
return x+x;
if (hx == 0x3f800000)
- return zero; /* log(1) = +0 */
+ return 0.0f; /* log(1) = +0 */
k += (hx>>23) - 127;
hx &= 0x007fffff;
i = (hx+(0x4afb0d))&0x800000;