| 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 oneo_180_t : eve::constant_callable<oneo_180_t, Options> | ||
| 17 | { | ||
| 18 | 1620 | 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 | 8 | return 1 / u_t(180); | |
| 25 | } | ||
| 26 | if constexpr (plf::dimension_v<T> == 2) | ||
| 27 | { | ||
| 28 | if constexpr (std::same_as<u_t, float>) | ||
| 29 | 402 | return plf::_::from_pair<u_t>(0x1.6c16c20000000p-8, -0x1.27d27e0000000p-33); | |
| 30 | else if constexpr (std::same_as<u_t, double>) | ||
| 31 | 404 | return plf::_::from_pair<u_t>(0x1.6c16c16c16c17p-8, -0x1.f49f49f49f49fp-63); | |
| 32 | } | ||
| 33 | else if constexpr (plf::dimension_v<T> == 3) | ||
| 34 | { | ||
| 35 | if constexpr (std::same_as<u_t, float>) | ||
| 36 | 402 | return plf::_::from_triple<u_t>(0x1.6c16c20000000p-8, -0x1.27d27e0000000p-33, 0x1.b05b060000000p-58); | |
| 37 | else if constexpr (std::same_as<u_t, double>) | ||
| 38 | 404 | return plf::_::from_triple<u_t>(0x1.6c16c16c16c17p-8, -0x1.f49f49f49f49fp-63, -0x1.27d27d27d27d2p-117); | |
| 39 | } | ||
| 40 | } | ||
| 41 | |||
| 42 | 1620 | template<concepts::polyfloat_like T> POLYFLOAT_ABI constexpr T operator()(as<T> const& v) const | |
| 43 | { | ||
| 44 | 1620 | return POLYFLOAT_CALL(v); | |
| 45 | } | ||
| 46 | |||
| 47 | POLYFLOAT_CALLABLE_OBJECT(oneo_180_t, oneo_180_); | ||
| 48 | }; | ||
| 49 | //====================================================================================================================== | ||
| 50 | //! @addtogroup constants | ||
| 51 | //! @{ | ||
| 52 | //! @var oneo_180 | ||
| 53 | //! @brief return the oneo_180 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 oneo_180(T z) noexcept; | ||
| 67 | //! } | ||
| 68 | //! @endcode | ||
| 69 | //! | ||
| 70 | //! **Parameters** | ||
| 71 | //! | ||
| 72 | //! * `z`: Value to process. | ||
| 73 | //! | ||
| 74 | //! **Return value** | ||
| 75 | //! | ||
| 76 | //! Returns the oneo_180 value as T. | ||
| 77 | //! | ||
| 78 | //! @groupheader{Example} | ||
| 79 | //! | ||
| 80 | //! @godbolt_todo{doc/oneo_180.cpp} | ||
| 81 | //====================================================================================================================== | ||
| 82 | |||
| 83 | inline constexpr auto oneo_180 = eve::functor<oneo_180_t>; | ||
| 84 | //====================================================================================================================== | ||
| 85 | //! @} | ||
| 86 | //====================================================================================================================== | ||
| 87 | } | ||
| 88 |