| 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/is_not_equal.hpp> | ||
| 15 | #include <polyfloat/details/graillat.hpp> | ||
| 16 | |||
| 17 | namespace plf | ||
| 18 | { | ||
| 19 | |||
| 20 | template<typename Options> | ||
| 21 | struct three_add_t : eve::strict_tuple_callable<three_add_t, Options, raw_option, pedantic_option> | ||
| 22 | { | ||
| 23 | template<concepts::polyfloat_like Z> | ||
| 24 | 16 | POLYFLOAT_ABI eve::zipped<Z, Z, Z> constexpr operator()(Z z0, Z z1, Z z2) const noexcept | |
| 25 | { | ||
| 26 | 16 | return POLYFLOAT_CALL(z0, z1, z2); | |
| 27 | } | ||
| 28 | |||
| 29 | 16 | POLYFLOAT_CALLABLE_OBJECT(three_add_t, three_add_); | |
| 30 | }; | ||
| 31 | //====================================================================================================================== | ||
| 32 | //! @addtogroup core_accuracy | ||
| 33 | //! @{ | ||
| 34 | //! @var three_add | ||
| 35 | //! @brief return the sum of the parameters with errors. | ||
| 36 | //! | ||
| 37 | //! @groupheader{Header file} | ||
| 38 | //! | ||
| 39 | //! @code | ||
| 40 | //! #include <polyfloat/module/core.hpp> | ||
| 41 | //! @endcode | ||
| 42 | //! | ||
| 43 | //! @groupheader{Callable Signatures} | ||
| 44 | //! | ||
| 45 | //! @code | ||
| 46 | //! namespace polyfloat | ||
| 47 | //! { | ||
| 48 | //! template<polyfloat::concepts::polyfloat_like Z1, polyfloat_like Z2, polyfloat_like Z3> constexpr auto three_add(Z1 z1, Z2 z2, Z3 z3) noexcept; | ||
| 49 | //! } | ||
| 50 | //! @endcode | ||
| 51 | //! | ||
| 52 | //! **Parameters** | ||
| 53 | //! | ||
| 54 | //! * `z1`, `z2`, `z3`: Values to process. | ||
| 55 | //! | ||
| 56 | //! **Return value** | ||
| 57 | //! | ||
| 58 | //! Returns the sum of the arguments and two errors . | ||
| 59 | //! | ||
| 60 | //! @groupheader{Example} | ||
| 61 | //! | ||
| 62 | //! @godbolt_todo{doc/core/core/three_add.cpp} | ||
| 63 | //====================================================================================================================== | ||
| 64 | |||
| 65 | inline constexpr auto three_add = eve::functor<three_add_t>; | ||
| 66 | //====================================================================================================================== | ||
| 67 | //! @} | ||
| 68 | //====================================================================================================================== | ||
| 69 | } | ||
| 70 | |||
| 71 | namespace plf::_ | ||
| 72 | { | ||
| 73 | |||
| 74 | template<typename Z, eve::callable_options O> | ||
| 75 | 16 | constexpr auto three_add_(POLYFLOAT_DELAY(), O const&, Z const& x, Z const& y, Z const& z) noexcept | |
| 76 | { | ||
| 77 | 32 | auto [xh, xl] = two_add(x, y); | |
| 78 | 16 | return cr_dw_fp_add_with_err(xl, xh, z); | |
| 79 | } | ||
| 80 | } | ||
| 81 |