X-Git-Url: http://nsz.repo.hu/git/?p=musl;a=blobdiff_plain;f=src%2Fmath%2Fexpf.c;h=3c3e2ab9b26a16c130d3d7c0a389ccd9c7cb285b;hp=a0eaa7a7ea15af737351b4c8d372f48f8a6c44ec;hb=6f64505df37c41d7496612dffe86048765339a7a;hpb=b69f695acedd4ce2798ef9ea28d834ceccc789bd diff --git a/src/math/expf.c b/src/math/expf.c index a0eaa7a7..3c3e2ab9 100644 --- a/src/math/expf.c +++ b/src/math/expf.c @@ -16,7 +16,6 @@ #include "libm.h" static const float -one = 1.0, halF[2] = {0.5,-0.5,}, huge = 1.0e+30, o_threshold = 8.8721679688e+01, /* 0x42b17180 */ @@ -33,7 +32,7 @@ invln2 = 1.4426950216e+00, /* 0x3fb8aa3b */ P1 = 1.6666625440e-1, /* 0xaaaa8f.0p-26 */ P2 = -2.7667332906e-3; /* -0xb55215.0p-32 */ -static volatile float twom100 = 7.8886090522e-31; /* 2**-100=0x0d800000 */ +static const volatile float twom100 = 7.8886090522e-31; /* 2**-100=0x0d800000 */ float expf(float x) { @@ -72,8 +71,8 @@ float expf(float x) STRICT_ASSIGN(float, x, hi - lo); } else if(hx < 0x39000000) { /* |x|<2**-14 */ /* raise inexact */ - if (huge+x > one) - return one + x; + if (huge+x > 1.0f) + return 1.0f + x; } else k = 0; @@ -85,11 +84,11 @@ float expf(float x) SET_FLOAT_WORD(twopk, 0x3f800000+((k+100)<<23)); c = x - t*(P1+t*P2); if (k == 0) - return one - ((x*c)/(c-(float)2.0)-x); - y = one - ((lo-(x*c)/((float)2.0-c))-hi); + return 1.0f - ((x*c)/(c - 2.0f) - x); + y = 1.0f - ((lo - (x*c)/(2.0f - c)) - hi); if (k < -125) return y*twopk*twom100; if (k == 128) - return y*2.0F*0x1p127F; + return y*2.0f*0x1p127f; return y*twopk; }