E.V.E
v2023.02.15

◆ next

eve::next = {}
inlineconstexpr

Computes the nth next representable element.

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template< eve::value T, eve::integral_value N >
eve::common_value_t<T, U> next(T x, N n = 1) noexcept;
}
constexpr callable_next_ next
Computes the nth next representable element.
Definition: next.hpp:130
Definition: abi.hpp:18
typename eve::detail::common_value_impl< void, Ts... >::type common_value_t
Computes the SIMD-compatible common type between all Ts.
Definition: common_value.hpp:50

Parameters

Return value

The value of the nth representable value greater than x is returned. If n is zero returns x.

Example

#include <eve/module/core.hpp>
#include <eve/wide.hpp>
#include <iostream>
#include <iomanip>
int main()
{
wide_ft pf = {-0.0f, 2.0f, eve::eps(eve::as<float>()), 0.0f};
wide_it pi = {-1, 2, -3, -32};
std::cout << "---- simd" << '\n'
<< "<- pf = " << std::setprecision(12) << pf << '\n'
<< "-> next(pf) = " << eve::next(pf) << '\n'
<< "-> pedantic(next)(pf) = " << eve::pedantic(eve::next)(pf) << '\n'
<< "<- pi = " << pi << '\n'
<< "-> next(pi) = " << eve::next(pi) << '\n';
float xf = 0.0f;
std::int16_t xi = -3;
std::cout << "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "-> next(xf, 3) = " << eve::next(xf, 3) << '\n'
<< "<- xi = " << xi << '\n'
<< "-> next(xi) = " << eve::next(xi) << '\n';
return 0;
}
constexpr callable_eps_ eps
Computes the the machine epsilon.
Definition: eps.hpp:63
constexpr pedantic_type const pedantic
Higher-order Callable Object imbuing more standard semantic onto other Callable Objects.
Definition: pedantic.hpp:56
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

Semantic Modifiers

  • Masked Call

    The call eve::next[mask](x, ...) provides a masked version of next which is equivalent to if_else(mask, next(x, ...), x)

    Example

    #include <eve/module/core.hpp>
    #include <eve/wide.hpp>
    #include <iostream>
    #include <iomanip>
    int main()
    {
    wide_ft pf = {-10.0f, 2.0f, eve::eps(eve::as<float>()), 0.0f};
    std::cout << "---- simd" << '\n'
    << "<- pf = " << std::setprecision(12) << pf << '\n'
    << "-> next[pf > 0](pf) = " << eve::next[pf > 0](pf) << '\n';
    return 0;
    }
  • eve::pedantic

    The call eve::pedantic(eve::next)(x, ...) provides a pedantic version of next which ensures that the successor of eve::mzero is eve::zero for floating points entries

    Example

    #include <eve/module/core.hpp>
    #include <eve/wide.hpp>
    #include <iostream>
    #include <iomanip>
    int main()
    {
    wide_ft pf = {-10.0f, 2.0f, eve::eps(eve::as<float>()), 0.0f};
    std::cout << "---- simd" << '\n'
    << "<- pf = " << std::setprecision(12) << pf << '\n'
    << "-> next[pf > 0](pf) = " << eve::next[pf > 0](pf) << '\n';
    return 0;
    }
  • eve::saturated

    The call eve::pedantic(eve::next)(x, ...) provides a pedantic version of next which ensures that eve::minf and eve::nan are fixed points.

    Example

    #include <eve/module/core.hpp>
    #include <eve/wide.hpp>
    #include <iostream>
    #include <iomanip>
    int main()
    {
    wide_ft pf = {-10.0f, 2.0f, eve::eps(eve::as<float>()), 0.0f};
    std::cout << "---- simd" << '\n'
    << "<- pf = " << std::setprecision(12) << pf << '\n'
    << "-> next[pf > 0](pf) = " << eve::next[pf > 0](pf) << '\n';
    return 0;
    }