| 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 <type_traits> | ||
| 14 | #include <polyfloat/module/core/abs.hpp> | ||
| 15 | #include <polyfloat/module/core/if_else.hpp> | ||
| 16 | #include <polyfloat/module/core/is_less.hpp> | ||
| 17 | #include <polyfloat/module/core/parts.hpp> | ||
| 18 | |||
| 19 | namespace plf | ||
| 20 | { | ||
| 21 | |||
| 22 | template<typename Options> | ||
| 23 | struct negmaxabs_t : eve::strict_tuple_callable<negmaxabs_t, Options, raw_option, pedantic_option> | ||
| 24 | { | ||
| 25 | template<concepts::polyfloat_like Z1, concepts::polyfloat_like... Zs> | ||
| 26 | 40 | POLYFLOAT_ABI constexpr as_polyfloat_like_t<Z1, Zs...> operator()(Z1 z1, Zs... zs) const noexcept | |
| 27 | { | ||
| 28 | 40 | return POLYFLOAT_CALL(z1, zs...); | |
| 29 | } | ||
| 30 | |||
| 31 | 40 | POLYFLOAT_CALLABLE_OBJECT(negmaxabs_t, negmaxabs_); | |
| 32 | }; | ||
| 33 | //====================================================================================================================== | ||
| 34 | //! @addtogroup core | ||
| 35 | //! @{ | ||
| 36 | //! @var negmaxabs | ||
| 37 | //! @brief return the negated maximum of the absolute values. | ||
| 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 T1, polyfloat_like Z2> constexpr auto negmaxabs(T1 z1, T2 z2) noexcept; | ||
| 51 | //! } | ||
| 52 | //! @endcode | ||
| 53 | //! | ||
| 54 | //! **Parameters** | ||
| 55 | //! | ||
| 56 | //! * `z, zs...`: Values to process. | ||
| 57 | //! | ||
| 58 | //! **Return value** | ||
| 59 | //! | ||
| 60 | //! Returns the negated maximum value of the absolute values of the parameters. | ||
| 61 | //! | ||
| 62 | //! @groupheader{Example} | ||
| 63 | //! | ||
| 64 | //! @godbolt_todo{doc/core/negmaxabs.cpp} | ||
| 65 | //====================================================================================================================== | ||
| 66 | |||
| 67 | inline constexpr auto negmaxabs = eve::functor<negmaxabs_t>; | ||
| 68 | //====================================================================================================================== | ||
| 69 | //! @} | ||
| 70 | //====================================================================================================================== | ||
| 71 | |||
| 72 | } | ||
| 73 | |||
| 74 | namespace plf::_ | ||
| 75 | { | ||
| 76 | template<typename Z1, typename... Zs, eve::callable_options O> | ||
| 77 | 40 | constexpr auto negmaxabs_(POLYFLOAT_DELAY(), O const&, Z1 z1, Zs... zs) noexcept | |
| 78 | { | ||
| 79 | 40 | return -plf::maxabs(z1, zs...); | |
| 80 | } | ||
| 81 | } | ||
| 82 |