E.V.E  0.1-beta

◆ nextafter

eve::nextafter = {}
inlineconstexpr

Callable object computing the nextafter operation.

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

Members Functions

Member Effect
operator() the nextafter operation

template< value T, value U > auto operator()( T x, U y ) const noexcept requires compatible< T, U >;

Parameters

x, y: values.

Return value

computes elementwise the representable value next to x in the direction of y.


Supported decorators

no decorators are supported

Example

See it live on Compiler Explorer

#include <eve/function/nextafter.hpp>
#include <eve/constant/eps.hpp>
#include <eve/constant/inf.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};
w_t qi = {-1.0f, -2.0f, 3.0f, eve::inf(eve::as<float>())};
std::cout << "---- simd" << std::setprecision(9) << '\n'
<< " <- pi = " << pi << '\n'
<< " <- qi = " << qi << '\n'
<< " -> nextafter(pi, qi) = " << eve::nextafter(pi, qi) << '\n';
std::uint32_t xi = 3, yi = 7;
std::cout << "---- scalar" << '\n'
<< " xi = " << xi << '\n'
<< " yi = " << yi << '\n'
<< " -> nextafter(xi, yi) = " << eve::nextafter(xi, yi) << '\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
constexpr callable_inf_ inf
Callable object computing the infinity ieee value.
Definition: inf.hpp:54
constexpr callable_nextafter_ nextafter
Callable object computing the nextafter operation.
Definition: nextafter.hpp:59
Lightweight type-wrapper.
Definition: as.hpp:29
Wrapper for SIMD registers.
Definition: wide.hpp:65