| 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 <eve/eve.hpp> | ||
| 11 | #include <polyfloat/details/callable.hpp> | ||
| 12 | #include <polyfloat/types/concepts.hpp> | ||
| 13 | #include <polyfloat/types/traits.hpp> | ||
| 14 | |||
| 15 | namespace plf | ||
| 16 | { | ||
| 17 | template<typename Options> | ||
| 18 | struct maxflint_t : plf::constant_callable<maxflint_t, eve::maxflint_t, Options, lower_option, upper_option> | ||
| 19 | { | ||
| 20 | 972 | template<typename T> POLYFLOAT_ABI static constexpr auto value(eve::as<T> const&, auto const&) | |
| 21 | { | ||
| 22 | 488 | if constexpr (dimension_v<T> == 2) return T(ldexp(1.0, 106), ldexp(1.0, 53)); | |
| 23 | 484 | else if constexpr (dimension_v<T> == 3) return T(ldexp(1.0, 159), ldexp(1.0, 106), ldexp(1.0, 53)); | |
| 24 | } | ||
| 25 | |||
| 26 | 972 | template<concepts::polyfloat_like T> POLYFLOAT_ABI constexpr T operator()(as<T> const& v) const | |
| 27 | { | ||
| 28 | 972 | return POLYFLOAT_CALL(v); | |
| 29 | } | ||
| 30 | |||
| 31 | POLYFLOAT_CALLABLE_OBJECT(maxflint_t, maxflint_); | ||
| 32 | }; | ||
| 33 | //====================================================================================================================== | ||
| 34 | //! @addtogroup constants | ||
| 35 | //! @{ | ||
| 36 | //! @var maxflint | ||
| 37 | //! @brief return the maximal representable flint value. | ||
| 38 | //! | ||
| 39 | //! @groupheader{Header file} | ||
| 40 | //! | ||
| 41 | //! @code | ||
| 42 | //! #include <polyfloat/core.hpp> | ||
| 43 | //! @endcode | ||
| 44 | //! | ||
| 45 | //! @groupheader{Callable Signatures} | ||
| 46 | //! | ||
| 47 | //! @code | ||
| 48 | //! namespace polyfloat | ||
| 49 | //! { | ||
| 50 | //! template<polyfloat::concepts::polyfloat_like T> constexpr auto maxflint(T z) noexcept; | ||
| 51 | //! } | ||
| 52 | //! @endcode | ||
| 53 | //! | ||
| 54 | //! **Parameters** | ||
| 55 | //! | ||
| 56 | //! * `z`: Value to process. | ||
| 57 | //! | ||
| 58 | //! **Return value** | ||
| 59 | //! | ||
| 60 | //! Returns the maximal representable flint value. | ||
| 61 | //! | ||
| 62 | //! @groupheader{Example} | ||
| 63 | //! | ||
| 64 | //! @godbolt{doc/core/maxflint.cpp} | ||
| 65 | //====================================================================================================================== | ||
| 66 | |||
| 67 | inline constexpr auto maxflint = eve::functor<maxflint_t>; | ||
| 68 | //====================================================================================================================== | ||
| 69 | //! @} | ||
| 70 | //====================================================================================================================== | ||
| 71 | } | ||
| 72 |