X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fmath%2Fatan2f.c;h=96839cbad8794b11376bd6444c33bdf4351622e6;hb=74025c80ce1eb4cda110ab2e3ac11718d3c6f2ff;hp=4d78840be3ec31043dabe05d718a3ca25b36682a;hpb=b69f695acedd4ce2798ef9ea28d834ceccc789bd;p=musl diff --git a/src/math/atan2f.c b/src/math/atan2f.c index 4d78840b..96839cba 100644 --- a/src/math/atan2f.c +++ b/src/math/atan2f.c @@ -15,14 +15,13 @@ #include "libm.h" -static volatile float +static const volatile float tiny = 1.0e-30; static const float -zero = 0.0, pi_o_4 = 7.8539818525e-01, /* 0x3f490fdb */ pi_o_2 = 1.5707963705e+00, /* 0x3fc90fdb */ pi = 3.1415927410e+00; /* 0x40490fdb */ -static volatile float +static const volatile float pi_lo = -8.7422776573e-08; /* 0xb3bbbd2e */ float atan2f(float y, float x) @@ -58,13 +57,13 @@ float atan2f(float y, float x) switch (m) { case 0: return pi_o_4+tiny; /* atan(+INF,+INF) */ case 1: return -pi_o_4-tiny; /* atan(-INF,+INF) */ - case 2: return (float)3.0*pi_o_4+tiny; /*atan(+INF,-INF)*/ - case 3: return (float)-3.0*pi_o_4-tiny; /*atan(-INF,-INF)*/ + case 2: return 3.0f*pi_o_4+tiny; /*atan(+INF,-INF)*/ + case 3: return -3.0f*pi_o_4-tiny; /*atan(-INF,-INF)*/ } } else { switch (m) { - case 0: return zero; /* atan(+...,+INF) */ - case 1: return -zero; /* atan(-...,+INF) */ + case 0: return 0.0f; /* atan(+...,+INF) */ + case 1: return -0.0f; /* atan(-...,+INF) */ case 2: return pi+tiny; /* atan(+...,-INF) */ case 3: return -pi-tiny; /* atan(-...,-INF) */ } @@ -77,7 +76,7 @@ float atan2f(float y, float x) /* compute y/x */ k = (iy-ix)>>23; if (k > 26) { /* |y/x| > 2**26 */ - z = pi_o_2+(float)0.5*pi_lo; + z = pi_o_2 + 0.5f*pi_lo; m &= 1; } else if (k < -26 && hx < 0) /* 0 > |y|/x > -2**-26 */ z = 0.0;