GCC Code Coverage Report


Directory: include/polyfloat/
File: include/polyfloat/module/core/three_fma.hpp
Date: 2026-11-09 15:28:50
Exec Total Coverage
Lines: 6 6 100.0%
Functions: 3 3 100.0%
Branches: 0 0 -%

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