summaryrefslogtreecommitdiff
path: root/src/math/log.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/log.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/log.c')
-rw-r--r--src/math/log.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/math/log.c b/src/math/log.c
index 1bb006a3..98051205 100644
--- a/src/math/log.c
+++ b/src/math/log.c
@@ -74,8 +74,6 @@ Lg5 = 1.818357216161805012e-01, /* 3FC74664 96CB03DE */
Lg6 = 1.531383769920937332e-01, /* 3FC39A09 D078C69F */
Lg7 = 1.479819860511658591e-01; /* 3FC2F112 DF3E5244 */
-static const double zero = 0.0;
-
double log(double x)
{
double hfsq,f,s,z,R,w,t1,t2,dk;
@@ -87,9 +85,9 @@ double log(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;
@@ -104,9 +102,9 @@ double log(double x)
k += i>>20;
f = x - 1.0;
if ((0x000fffff&(2+hx)) < 3) { /* -2**-20 <= f < 2**-20 */
- if (f == zero) {
+ if (f == 0.0) {
if (k == 0) {
- return zero;
+ return 0.0;
}
dk = (double)k;
return dk*ln2_hi + dk*ln2_lo;