182 const float a1 = +0x1.ffffeap-1f;
183 const float a3 = -0x1.55437p-2f;
184 const float a5 = +0x1.972be6p-3f;
185 const float a7 = -0x1.1436ap-3f;
186 const float a9 = +0x1.5785aap-4f;
187 const float a11 = -0x1.2f3004p-5f;
188 const float a13 = +0x1.01a37cp-7f;
190 const float x_times_x = x * x;
192 arctan = fmaf(x_times_x, arctan, a11);
193 arctan = fmaf(x_times_x, arctan, a9);
194 arctan = fmaf(x_times_x, arctan, a7);
195 arctan = fmaf(x_times_x, arctan, a5);
196 arctan = fmaf(x_times_x, arctan, a3);
197 arctan = fmaf(x_times_x, arctan, a1);
254 const float two_over_pi = 0x1.45f306p-1f;
255 const float pi_over_2_hi = 0x1.921fb6p+0f;
256 const float pi_over_2_lo = -0x1.777a5cp-25f;
258 float n_f = rintf(x * two_over_pi);
261 float r = fmaf(-n_f, pi_over_2_hi, x);
262 r = fmaf(-n_f, pi_over_2_lo, r);
268 float result = (n & 1) ? cos_r : sin_r;
269 return (n & 2) ? -result : result;
280 const float two_over_pi = 0x1.45f306p-1f;
281 const float pi_over_2_hi = 0x1.921fb6p+0f;
282 const float pi_over_2_lo = -0x1.777a5cp-25f;
284 float n_f = rintf(x * two_over_pi);
287 float r = fmaf(-n_f, pi_over_2_hi, x);
288 r = fmaf(-n_f, pi_over_2_lo, r);
294 float result = (n & 1) ? sin_r : cos_r;
295 return ((n + 1) & 2) ? -result : result;
337 const float pi = 0x1.921fb6p1f;
338 const float pi_2 = 0x1.921fb6p0f;
341 if (isnan(x) || isnan(y)) {
349 const float angle = (x > 0.f) ? (pi_2 / 2.f) : (3.f * pi_2 / 2.f);
350 return copysignf(angle, y);
353 return copysignf(pi_2, y);
358 return (x > 0.f) ? copysignf(0.f, y) : copysignf(pi, y);
361 if (fabs(x) == 0.f) {
362 return (fabs(y) == 0.f) ? copysignf(0.f, y) : copysignf(pi_2, y);
364 const int swap = fabs(x) < fabs(y);
365 const float numerator = swap ? x : y;
366 const float denominator = swap ? y : x;
367 float input = numerator / denominator;
374 result = swap ? (input >= 0.f ? pi_2 : -pi_2) - result : result;
376 result += copysignf(pi, y);