E.V.E  0.1-beta

◆ eps

eve::eps = {}
inlineconstexpr

Callable object computing the machine epsilon.

Required header: #include <eve/function/eps.hpp>

Member Effect
operator() Computes the eps constant

tempate < real_value T > T operator()( as<T> const & t) const noexcept;
Lightweight type-wrapper.
Definition: as.hpp:29

Parameters

t: Type wrapper instance embedding the type of the constant.

Return value

the call eve::eps(as<T>()) returns elementwise, the smallest positive value x of the type such that 1+x != x.


Example

See it live on Compiler Explorer

#include <eve/function/eps.hpp>
#include <eve/constant/bitincrement.hpp>
#include <eve/constant/eps.hpp>
#include <eve/wide.hpp>
#include <iomanip>
int main()
{
wide_ft pf = {0.0f, 2.0f, eve::eps(eve::as<float>()), eve::Bitincrement(eve::as<float>())};
wide_it pi = {-1, 2, -3, -32};
std::cout << "---- simd" << '\n'
<< "<- pf = " << std::setprecision(12) << pf << '\n'
<< "-> eve::eps(pf) = " << eve::eps(pf) << '\n'
<< "<- pi = " << pi << '\n'
<< "-> eve::eps(pi) = " << eve::eps(pi) << '\n';
float xf = 0.0f;
std::int16_t xi = -3;
std::cout << "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "-> eve::eps(xf) = " << eve::eps(xf) << '\n'
<< "<- xi = " << xi << '\n'
<< "-> eve::eps(xi) = " << eve::eps(xi) << '\n';
return 0;
}
constexpr callable_eps_ eps
Callable object computing the machine epsilon.
Definition: eps.hpp:60
constexpr callable_pi_ pi
Callable object computing the value.
Definition: pi.hpp:54
Wrapper for SIMD registers.
Definition: wide.hpp:65