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