diff options
author | nsz <nsz@port70.net> | 2012-03-19 23:41:19 +0100 |
---|---|---|
committer | nsz <nsz@port70.net> | 2012-03-19 23:41:19 +0100 |
commit | 0cbb65479147ecdaa664e88cc2a5a925f3de502f (patch) | |
tree | 7b6dc53fcec6497d55746d3cc47f167a20b7aa57 /src/math/expm1f.c | |
parent | b03255af77776703c8d48819e824d09f6f54ba86 (diff) | |
download | musl-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/expm1f.c')
-rw-r--r-- | src/math/expm1f.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/math/expm1f.c b/src/math/expm1f.c index a8b79e88..d9568466 100644 --- a/src/math/expm1f.c +++ b/src/math/expm1f.c @@ -16,7 +16,6 @@ #include "libm.h" static const float -one = 1.0, huge = 1.0e+30, tiny = 1.0e-30, o_threshold = 8.8721679688e+01, /* 0x42b17180 */ @@ -54,7 +53,7 @@ float expm1f(float x) if (xsb != 0) { /* x < -27*ln2 */ /* raise inexact */ if (x+tiny < 0.0f) - return tiny-one; /* return -1 */ + return tiny-1.0f; /* return -1 */ } } @@ -87,7 +86,7 @@ float expm1f(float x) /* x is now in primary range */ hfx = 0.5f*x; hxs = x*hfx; - r1 = one+hxs*(Q1+hxs*Q2); + r1 = 1.0f+hxs*(Q1+hxs*Q2); t = 3.0f - r1*hfx; e = hxs*((r1-t)/(6.0f - x*t)); if (k == 0) /* c is 0 */ @@ -100,17 +99,17 @@ float expm1f(float x) if (k == 1) { if (x < -0.25f) return -2.0f*(e-(x+0.5f)); - return one + 2.0f*(x-e); + return 1.0f + 2.0f*(x-e); } if (k <= -2 || k > 56) { /* suffice to return exp(x)-1 */ - y = one - (e - x); + y = 1.0f - (e - x); if (k == 128) y = y*2.0f*0x1p127f; else y = y*twopk; - return y - one; + return y - 1.0f; } - t = one; + t = 1.0f; if (k < 23) { SET_FLOAT_WORD(t, 0x3f800000 - (0x1000000>>k)); /* t=1-2^-k */ y = t - (e - x); @@ -118,7 +117,7 @@ float expm1f(float x) } else { SET_FLOAT_WORD(t, (0x7f-k)<<23); /* 2^-k */ y = x - (e + t); - y += one; + y += 1.0f; y = y*twopk; } return y; |