E.V.E
v2022.09.01

◆ dist

eve::dist = {}
inlineconstexpr

Computes the 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> dist(T x, U y) noexcept;
}
constexpr callable_dist_ dist
Computes the distance of its arguments.
Definition: dist.hpp:62
Definition: all_of.hpp:22

Parameters

Return value

The value of the distance of the arguments is returned, i.e. eve::abs (x-y).

Example

#include <eve/module/core.hpp>
#include <eve/wide.hpp>
#include <iostream>
int main()
{
wide_it pf = {0, 1, -1, -eve::valmax(eve::as<int16_t>())};
wide_it qf = {1, -1, 0, eve::valmax(eve::as<int16_t>())};
std::cout << "---- simd" << '\n'
<< "<- pf = " << pf << '\n'
<< "<- qf = " << qf << '\n'
<< "-> dist(pf, qf) = " << eve::dist(pf, qf) << '\n';
int16_t xf = -eve::valmax(eve::as<int16_t>());
int16_t yf = eve::valmax(eve::as<int16_t>());
std::cout << "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "<- yf = " << yf << '\n'
<< "-> dist(xf, yf) = " << eve::dist(xf, yf) << '\n';
return 0;
}
constexpr callable_valmax_ valmax
Computes the the greatest representable value.
Definition: valmax.hpp:55
Lightweight type-wrapper.
Definition: as.hpp:29
Wrapper for SIMD registers.
Definition: wide.hpp:65

Semantic Modifiers