| 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 <eve/module/math/constant/euler.hpp> | ||
| 14 | |||
| 15 | namespace plf | ||
| 16 | { | ||
| 17 | |||
| 18 | template<typename Options> | ||
| 19 | struct euler_t : plf::constant_callable<euler_t, eve::euler_t, Options, lower_option, upper_option> | ||
| 20 | { | ||
| 21 | 6532 | template<typename T> POLYFLOAT_ABI static constexpr T value(eve::as<T> const&, auto const&) | |
| 22 | { | ||
| 23 | using u_t = plf::as_component_type_t<T>; | ||
| 24 | if constexpr (plf::dimension_v<T> == 2) | ||
| 25 | { | ||
| 26 | 1076 | if constexpr (std::same_as<u_t, float>) return plf::_::from_pair<float>(0x1.5bf0a8p+1, 0x1.628aeep-24); | |
| 27 | else if constexpr (std::same_as<u_t, double>) | ||
| 28 | 1013 | return plf::_::from_pair<double>(0x1.5bf0a8b145769p+1, 0x1.4d57ee2b1013ap-53); | |
| 29 | } | ||
| 30 | else if constexpr (plf::dimension_v<T> == 3) | ||
| 31 | { | ||
| 32 | if constexpr (std::same_as<u_t, float>) | ||
| 33 | 2242 | return plf::_::from_triple<float>(0x1.5bf0a8p+1, 0x1.628aeep-24, -0x1.ab2a82p-49); | |
| 34 | else if constexpr (std::same_as<u_t, double>) | ||
| 35 | 2201 | return plf::_::from_triple<double>(0x1.5bf0a8b145769p+1, 0x1.4d57ee2b1013ap-53, -0x1.618713a31d3e2p-109); | |
| 36 | } | ||
| 37 | } | ||
| 38 | |||
| 39 | 6536 | template<concepts::polyfloat_like T> POLYFLOAT_ABI constexpr T operator()(as<T> const& v) const | |
| 40 | { | ||
| 41 | 6536 | return POLYFLOAT_CALL(v); | |
| 42 | } | ||
| 43 | |||
| 44 | POLYFLOAT_CALLABLE_OBJECT(euler_t, euler_); | ||
| 45 | }; | ||
| 46 | //====================================================================================================================== | ||
| 47 | //! @addtogroup constants | ||
| 48 | //! @{ | ||
| 49 | //! @var euler | ||
| 50 | //! @brief return the exp(1) 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 euler(T z) noexcept; | ||
| 64 | //! } | ||
| 65 | //! @endcode | ||
| 66 | //! | ||
| 67 | //! | ||
| 68 | //! **Return value** | ||
| 69 | //! | ||
| 70 | //! Returns exp(1). | ||
| 71 | //! | ||
| 72 | //! @groupheader{Example} | ||
| 73 | //! | ||
| 74 | //! @godbolt_todo{doc/euler.cpp} | ||
| 75 | //====================================================================================================================== | ||
| 76 | |||
| 77 | inline constexpr auto euler = eve::functor<euler_t>; | ||
| 78 | //====================================================================================================================== | ||
| 79 | //! @} | ||
| 80 | //====================================================================================================================== | ||
| 81 | } | ||
| 82 |