E.V.E
v2022.09.01

◆ ulpdist

eve::ulpdist = {}
inlineconstexpr

Computes the unit in the last place distance of its arguments. Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template< eve::value T, eve::value U >
eve::common_compatible_t<T, U> ulpdist(T x, U y) noexcept;
}
constexpr callable_ulpdist_ ulpdist
Computes the unit in the last place distance of its arguments. Defined in Header
Definition: ulpdist.hpp:62
Definition: all_of.hpp:22

Parameters

Return value

Computes elementwise the 'units in the last place' distance between x and y. This is semantically equivalent to:`

  • if is_ordered(x,y), nb_values(x,y)/2.0 is returned
  • otherwise a Nan is returned

Example

#include <eve/module/core.hpp>
#include <eve/wide.hpp>
#include <iostream>
#include <iomanip>
int main()
{
w_t pi = {0.0f, 1.0f, 1.0f-eve::eps(eve::as<float>())/2, 1.0f };
std::cout << "---- simd" << std::setprecision(9) << '\n'
<< " <- pi = " << pi << '\n'
<< " <- qi = " << qi << '\n'
<< " -> ulpdist(pi, qi) = " << eve::ulpdist(pi, qi) << '\n';
std::uint32_t xi = 3, yi = 7;
std::cout << "---- scalar" << '\n'
<< " xi = " << xi << '\n'
<< " yi = " << yi << '\n'
<< " -> ulpdist(xi, yi) = " << eve::ulpdist(xi, yi) << '\n';
return 0;
}
constexpr callable_smallestposval_ smallestposval
Computes the smallest normal positive value.
Definition: smallestposval.hpp:59
constexpr callable_inf_ inf
Computes the infinity ieee value.
Definition: inf.hpp:58
constexpr callable_pi_ pi
Callable object computing the constant .
Definition: pi.hpp:49
Lightweight type-wrapper.
Definition: as.hpp:29
Wrapper for SIMD registers.
Definition: wide.hpp:65