| 452 | namespace detail { |
| 453 | template <typename F> |
| 454 | inline F atan_poly_unit_(F u) FL_NOEXCEPT { |
| 455 | // Polynomial approximation of atan on [-1, 1]. |
| 456 | // Coefficients from Padé-style minimax fit; max abs error ~1.5e-3. |
| 457 | const F u2 = u * u; |
| 458 | return u * (F(0.99997726) + |
| 459 | u2 * (F(-0.33262347) + |
| 460 | u2 * (F(0.19354346) + |
| 461 | u2 * (F(-0.11643287) + |
| 462 | u2 * (F(0.05265332) + |
| 463 | u2 * F(-0.01172120)))))); |
| 464 | } |
| 465 | |
| 466 | template <typename F> |
| 467 | inline F atan_full_(F u) FL_NOEXCEPT { |