| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | //====================================================================================================================== | ||
| 2 | /* | ||
| 3 | POLYFLOAT - Extended precision floating points | ||
| 4 | Copyright : POLYFLOAT Contributors & Maintainers | ||
| 5 | SPDX-License-Identifier: BSL-1.0 | ||
| 6 | */ | ||
| 7 | //====================================================================================================================== | ||
| 8 | #pragma once | ||
| 9 | |||
| 10 | #include <polyfloat/details/callable.hpp> | ||
| 11 | #include <polyfloat/types/concepts.hpp> | ||
| 12 | #include <polyfloat/types/traits.hpp> | ||
| 13 | #include <type_traits> | ||
| 14 | #include <polyfloat/module/math/details/pio_2_splitting.hpp> | ||
| 15 | #include <polyfloat/module/math/details/cody_waite_reduce.hpp> | ||
| 16 | |||
| 17 | namespace plf::_ | ||
| 18 | { | ||
| 19 | 1120 | template<typename T> constexpr auto pio_2_reduce(T const& x) noexcept | |
| 20 | { | ||
| 21 | using e_t = eve::element_type_t<T>; | ||
| 22 | 1120 | auto const coefs = eve::coefficients(pio_2_splitting(as<e_t>())); | |
| 23 | ; | ||
| 24 | 1120 | auto invpio2 = 2 * plf::inv_pi(eve::as<e_t>()); | |
| 25 | 1120 | return cody_waite_reduce(x, invpio2, coefs); | |
| 26 | } | ||
| 27 | } | ||
| 28 |