From 8d0a6f7a1c47b280647f292e6864b85b72c71f2e Mon Sep 17 00:00:00 2001 From: nsz Date: Tue, 13 Mar 2012 20:24:23 +0100 Subject: math cleanup: use 1.0f instead of (float)1.0 --- src/math/expm1f.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/math/expm1f.c') diff --git a/src/math/expm1f.c b/src/math/expm1f.c index cfab6975..a8b79e88 100644 --- a/src/math/expm1f.c +++ b/src/math/expm1f.c @@ -53,7 +53,7 @@ float expm1f(float x) } if (xsb != 0) { /* x < -27*ln2 */ /* raise inexact */ - if (x+tiny < (float)0.0) + if (x+tiny < 0.0f) return tiny-one; /* return -1 */ } } @@ -71,7 +71,7 @@ float expm1f(float x) k = -1; } } else { - k = invln2*x+((xsb==0)?(float)0.5:(float)-0.5); + k = invln2*x + (xsb==0 ? 0.5f : -0.5f); t = k; hi = x - t*ln2_hi; /* t*ln2_hi is exact here */ lo = t*ln2_lo; @@ -85,27 +85,27 @@ float expm1f(float x) k = 0; /* x is now in primary range */ - hfx = (float)0.5*x; + hfx = 0.5f*x; hxs = x*hfx; r1 = one+hxs*(Q1+hxs*Q2); - t = (float)3.0 - r1*hfx; - e = hxs*((r1-t)/((float)6.0 - x*t)); + t = 3.0f - r1*hfx; + e = hxs*((r1-t)/(6.0f - x*t)); if (k == 0) /* c is 0 */ return x - (x*e-hxs); SET_FLOAT_WORD(twopk, 0x3f800000+(k<<23)); /* 2^k */ e = x*(e-c) - c; e -= hxs; if (k == -1) - return (float)0.5*(x-e) - (float)0.5; + return 0.5f*(x-e) - 0.5f; if (k == 1) { - if (x < (float)-0.25) - return -(float)2.0*(e-(x+(float)0.5)); - return one+(float)2.0*(x-e); + if (x < -0.25f) + return -2.0f*(e-(x+0.5f)); + return one + 2.0f*(x-e); } if (k <= -2 || k > 56) { /* suffice to return exp(x)-1 */ y = one - (e - x); if (k == 128) - y = y*2.0F*0x1p127F; + y = y*2.0f*0x1p127f; else y = y*twopk; return y - one; @@ -116,7 +116,7 @@ float expm1f(float x) y = t - (e - x); y = y*twopk; } else { - SET_FLOAT_WORD(t, ((0x7f-k)<<23)); /* 2^-k */ + SET_FLOAT_WORD(t, (0x7f-k)<<23); /* 2^-k */ y = x - (e + t); y += one; y = y*twopk; -- cgit v1.2.1