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/powf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/math/powf.c') diff --git a/src/math/powf.c b/src/math/powf.c index e322ff28..c78eb12f 100644 --- a/src/math/powf.c +++ b/src/math/powf.c @@ -145,7 +145,7 @@ float powf(float x, float y) /* now |1-x| is tiny <= 2**-20, suffice to compute log(x) by x-x^2/2+x^3/3-x^4/4 */ t = ax - 1; /* t has 20 trailing zeros */ - w = (t*t)*((float)0.5-t*((float)0.333333333333-t*(float)0.25)); + w = (t*t)*(0.5f - t*(0.333333333333f - t*0.25f)); u = ivln2_h*t; /* ivln2_h has 16 sig. bits */ v = t*ivln2_l - w*ivln2; t1 = u + v; @@ -193,10 +193,10 @@ float powf(float x, float y) r = s2*s2*(L1+s2*(L2+s2*(L3+s2*(L4+s2*(L5+s2*L6))))); r += s_l*(s_h+s); s2 = s_h*s_h; - t_h = (float)3.0 + s2 + r; + t_h = 3.0f + s2 + r; GET_FLOAT_WORD(is, t_h); SET_FLOAT_WORD(t_h, is & 0xfffff000); - t_l = r - ((t_h - (float)3.0) - s2); + t_l = r - ((t_h - 3.0f) - s2); /* u+v = s*(1+...) */ u = s_h*t_h; v = s_l*t_h + t_l*s; -- cgit v1.2.3-70-g09d2 From 32ca5ef3ff3069bdaae5f95be1900a3c3f831247 Mon Sep 17 00:00:00 2001 From: nsz Date: Tue, 13 Mar 2012 21:11:46 +0100 Subject: math cleanup: use 1.0f instead of 1.0F --- src/math/hypotf.c | 2 +- src/math/pow.c | 2 +- src/math/powf.c | 2 +- src/math/truncf.c | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/math/powf.c') diff --git a/src/math/hypotf.c b/src/math/hypotf.c index 40acd917..9fd77e6a 100644 --- a/src/math/hypotf.c +++ b/src/math/hypotf.c @@ -40,7 +40,7 @@ float hypotf(float x, float y) if (ha > 0x58800000) { /* a > 2**50 */ if(ha >= 0x7f800000) { /* Inf or NaN */ /* Use original arg order iff result is NaN; quieten sNaNs. */ - w = fabsf(x+0.0F) - fabsf(y+0.0F); + w = fabsf(x+0.0f) - fabsf(y+0.0f); if (ha == 0x7f800000) w = a; if (hb == 0x7f800000) w = b; return w; diff --git a/src/math/pow.c b/src/math/pow.c index f843645d..5bcedd5b 100644 --- a/src/math/pow.c +++ b/src/math/pow.c @@ -112,7 +112,7 @@ double pow(double x, double y) /* y != zero: result is NaN if either arg is NaN */ if (ix > 0x7ff00000 || (ix == 0x7ff00000 && lx != 0) || iy > 0x7ff00000 || (iy == 0x7ff00000 && ly != 0)) - return (x+0.0)+(y+0.0); // FIXME: x+y ? + return (x+0.0) + (y+0.0); /* determine if y is an odd int when x < 0 * yisint = 0 ... y is not an integer diff --git a/src/math/powf.c b/src/math/powf.c index c78eb12f..01aced0e 100644 --- a/src/math/powf.c +++ b/src/math/powf.c @@ -70,7 +70,7 @@ float powf(float x, float y) /* y != zero: result is NaN if either arg is NaN */ if (ix > 0x7f800000 || iy > 0x7f800000) - return (x+0.0F) + (y+0.0F); + return (x+0.0f) + (y+0.0f); /* determine if y is an odd int when x < 0 * yisint = 0 ... y is not an integer diff --git a/src/math/truncf.c b/src/math/truncf.c index 209586e1..0afcdfbf 100644 --- a/src/math/truncf.c +++ b/src/math/truncf.c @@ -20,7 +20,7 @@ #include "libm.h" -static const float huge = 1.0e30F; +static const float huge = 1.0e30f; float truncf(float x) { @@ -32,14 +32,14 @@ float truncf(float x) if (j0 < 23) { if (j0 < 0) { /* |x|<1, return 0*sign(x) */ /* raise inexact if x != 0 */ - if (huge+x > 0.0F) + if (huge+x > 0.0f) i0 &= 0x80000000; } else { i = 0x007fffff>>j0; if ((i0&i) == 0) return x; /* x is integral */ /* raise inexact */ - if (huge+x > 0.0F) + if (huge+x > 0.0f) i0 &= ~i; } } else { -- cgit v1.2.3-70-g09d2