summaryrefslogtreecommitdiff
path: root/src/math/logf.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/logf.c
parentb03255af77776703c8d48819e824d09f6f54ba86 (diff)
downloadmusl-0cbb65479147ecdaa664e88cc2a5a925f3de502f.tar.gz
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/logf.c')
-rw-r--r--src/math/logf.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/math/logf.c b/src/math/logf.c
index a4ed697b..c7f7dbe6 100644
--- a/src/math/logf.c
+++ b/src/math/logf.c
@@ -25,8 +25,6 @@ Lg2 = 0xccce13.0p-25, /* 0.40000972152 */
Lg3 = 0x91e9ee.0p-25, /* 0.28498786688 */
Lg4 = 0xf89e26.0p-26; /* 0.24279078841 */
-static const float zero = 0.0;
-
float logf(float x)
{
float hfsq,f,s,z,R,w,t1,t2,dk;
@@ -37,9 +35,9 @@ float logf(float x)
k = 0;
if (ix < 0x00800000) { /* x < 2**-126 */
if ((ix & 0x7fffffff) == 0)
- return -two25/zero; /* log(+-0)=-inf */
+ return -two25/0.0f; /* log(+-0)=-inf */
if (ix < 0)
- return (x-x)/zero; /* log(-#) = NaN */
+ return (x-x)/0.0f; /* log(-#) = NaN */
/* subnormal number, scale up x */
k -= 25;
x *= two25;
@@ -54,9 +52,9 @@ float logf(float x)
k += i>>23;
f = x - 1.0f;
if ((0x007fffff & (0x8000 + ix)) < 0xc000) { /* -2**-9 <= f < 2**-9 */
- if (f == zero) {
+ if (f == 0.0f) {
if (k == 0)
- return zero;
+ return 0.0f;
dk = (float)k;
return dk*ln2_hi + dk*ln2_lo;
}