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

◆ two_sub

auto eve::two_sub = functor<two_sub_t>
inlineconstexpr

Header file

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
// Regular overload
constexpr auto two_sub(floating_value auto x, floating_value auto y) noexcept; //1
constexpr auto two_sub[raw](floating_value auto x, floating_value auto y) noexcept; //2
// Semantic options
constexpr auto two_sub[pedantic](floating_value auto x, floating_value auto y) noexcept; //3
}
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_sub
Computes the elementwise pair consisting of the difference of the parameters and its resulting roundi...
Definition two_sub.hpp:80
constexpr auto raw
Performs the operation minimally, trading accuracy for speed.
Definition core.hpp:95
constexpr auto pedantic
Follows the corner cases of the corresponding standard function.
Definition core.hpp:91
EVE Main Namespace.
Definition abi.hpp:19

Parameters

Return value

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

  • a is x - y
  • e is a value such that a \(\oplus\)e is equal to x \(\oplus\)(-y) where \(\oplus\) adds its two parameters with infinite precision.
  1. Classical algorithm, always valid.
  2. 'Fast' algorithm, valid only if |x| < |y|.
  3. Handles overflow.

External references

Example

// revision 1
#include <eve/module/core.hpp>
#include <iostream>
#include <iomanip>
int main()
{
eve::wide wf0 = {3.0f, 2.5f, -32.7f, 1.0f};
eve::wide wf1 = {4.2f, 1.5f, -100.834f, eve::eps(eve::as<float>())/2};
std::cout << "<- wf0 = " << wf0 << "\n";
std::cout << "<- wf1 = " << wf1 << "\n";
std::cout << std::setprecision(20);
std::cout << "-> two_sub(wf0, wf1) = " << eve::two_sub(wf0, wf1) << "\n";
std::cout << "-> two_sub[raw](wf0, wf1) = " << eve::two_sub[eve::raw](wf0, wf1) << "\n";
}
constexpr auto eps
Computes a constant to the machine epsilon.
Definition eps.hpp:74
Lightweight type-wrapper.
Definition as.hpp:29
Wrapper for SIMD registers.
Definition wide.hpp:94