E.V.E
v2023.02.15
Loading...
Searching...
No Matches

◆ two_fma_approx

auto eve::two_fma_approx = functor<two_fma_approx_t>
inlineconstexpr

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
constexpr auto two_fma_approx(floating_value auto a, floating_value auto b, floating_value auto c) noexcept;
}
The concept floating_value<T> is satisfied if and only if T satisfies eve::value and the element type...
Definition value.hpp:116
constexpr auto two_fma_approx
Computes the elementwise triplet of an fma value f and two errors e1 and e2 such that .
Definition two_fma_approx.hpp:70
EVE Main Namespace.
Definition abi.hpp:19

Parameters

Return value

Computes elementwise a pair of values [f, e1] such that:

  • f is fma(a, x, y)
  • \f$ a\otimes x\oplus y = r1\oplus e1\f$ with a very small error (less than 14*eps)

where \(\oplus\) (resp. \(\otimes\)) adds (resp. multiplies) its two parameters with infinite precision.

External references

Example

// revision 0
#include <eve/module/core.hpp>
#include <iostream>
#include <iomanip>
int main()
{
eve::wide a = {1.0, 2.0, 3.0, 1.0e8};
eve::wide x = {0.1, 0.2, 0.3, 1.0e-8};
eve::wide y = {1.0e-20, 1.0, 2.0, 1.0};
std::cout << std::setprecision(20);
std::cout << "<- a = " << a << "\n";
std::cout << "<- x = " << x << "\n";
std::cout << "<- y = " << y << "\n";
auto [f, e1] = eve::two_fma_approx(a, x, y);
std::cout << "-> f (the fma itself) = " << f << "\n";
std::cout << "-> e1 (the rounding error) = " << e1 << "\n";
}
Wrapper for SIMD registers.
Definition wide.hpp:94