| 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 | |||
| 14 | namespace plf | ||
| 15 | { | ||
| 16 | template<typename Options> struct three_pio_4_t : eve::constant_callable<three_pio_4_t, Options> | ||
| 17 | { | ||
| 18 | 32 | template<typename T> POLYFLOAT_ABI static constexpr auto value(eve::as<T> const&, auto const&) | |
| 19 | { | ||
| 20 | using u_t = eve::underlying_type_t<T>; | ||
| 21 | |||
| 22 | if constexpr (plf::dimension_v<T> == 1) | ||
| 23 | { | ||
| 24 |
1/1✓ Branch 2 taken 4 times.
|
8 | return eve::three_pio_4(eve::as(u_t())); |
| 25 | } | ||
| 26 | if constexpr (plf::dimension_v<T> == 2) | ||
| 27 | { | ||
| 28 | if constexpr (std::same_as<u_t, float>) | ||
| 29 | 6 | return plf::_::from_pair<u_t>(0x1.2d97c80000000p+1, -0x1.99bc5c0000000p-28); | |
| 30 | else if constexpr (std::same_as<u_t, double>) | ||
| 31 | 6 | return plf::_::from_pair<u_t>(0x1.2d97c7f3321d2p+1, 0x1.a79394c9e8a0ap-54); | |
| 32 | } | ||
| 33 | else if constexpr (plf::dimension_v<T> == 3) | ||
| 34 | { | ||
| 35 | if constexpr (std::same_as<u_t, float>) | ||
| 36 | 6 | return plf::_::from_triple<u_t>(0x1.2d97c80000000p+1, -0x1.99bc5c0000000p-28, 0x1.a793940000000p-54); | |
| 37 | else if constexpr (std::same_as<u_t, double>) | ||
| 38 | 6 | return plf::_::from_triple<u_t>(0x1.2d97c7f3321d2p+1, 0x1.a79394c9e8a0ap-54, 0x1.456737b06ea1ap-108); | |
| 39 | } | ||
| 40 | } | ||
| 41 | |||
| 42 | 32 | template<concepts::polyfloat_like T> POLYFLOAT_ABI constexpr T operator()(as<T> const& v) const | |
| 43 | { | ||
| 44 | 32 | return POLYFLOAT_CALL(v); | |
| 45 | } | ||
| 46 | |||
| 47 | POLYFLOAT_CALLABLE_OBJECT(three_pio_4_t, three_pio_4_); | ||
| 48 | }; | ||
| 49 | //====================================================================================================================== | ||
| 50 | //! @addtogroup constants | ||
| 51 | //! @{ | ||
| 52 | //! @var three_pio_4 | ||
| 53 | //! @brief return the three_pio_4 value. | ||
| 54 | //! | ||
| 55 | //! @groupheader{Header file} | ||
| 56 | //! | ||
| 57 | //! @code | ||
| 58 | //! #include <polyfloat/core.hpp> | ||
| 59 | //! @endcode | ||
| 60 | //! | ||
| 61 | //! @groupheader{Callable Signatures} | ||
| 62 | //! | ||
| 63 | //! @code | ||
| 64 | //! namespace polyfloat | ||
| 65 | //! { | ||
| 66 | //! template<polyfloat::concepts::polyfloat_like T> constexpr auto three_pio_4(T z) noexcept; | ||
| 67 | //! } | ||
| 68 | //! @endcode | ||
| 69 | //! | ||
| 70 | //! **Parameters** | ||
| 71 | //! | ||
| 72 | //! * `z`: Value to process. | ||
| 73 | //! | ||
| 74 | //! **Return value** | ||
| 75 | //! | ||
| 76 | //! Returns the three_pio_4 value as T. | ||
| 77 | //! | ||
| 78 | //! @groupheader{Example} | ||
| 79 | //! | ||
| 80 | //! @godbolt_todo{doc/three_pio_4.cpp} | ||
| 81 | //====================================================================================================================== | ||
| 82 | |||
| 83 | inline constexpr auto three_pio_4 = eve::functor<three_pio_4_t>; | ||
| 84 | //====================================================================================================================== | ||
| 85 | //! @} | ||
| 86 | //====================================================================================================================== | ||
| 87 | } | ||
| 88 |