E.V.E
v2023.02.15
 
Loading...
Searching...
No Matches

◆ prev

auto eve::prev = functor<prev_t>
inlineconstexpr

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
// Regular overloads
constexpr auto prev(value auto x) noexcept; // 1
constexpr auto prev(value auto x, integral_value auto n) noexcept; // 2
// Lanes masking
constexpr auto prev[conditional_expr auto c](/* any of the above overloads */) noexcept; // 3
constexpr auto prev[logical_value auto m](/* any of the above overloads */) noexcept; // 3
// Exclusive Semantic options - Only one of those can be set at once
constexpr auto prev[pedantic](/* any of the above overloads */) noexcept; // 4
constexpr auto prev[saturated ](/* any of the above overloads */) noexcept; // 5
constexpr auto prev[raw](value auto x) noexcept; // 6
}
Specifies that a type is a Conditional Expression.
Definition conditional.hpp:28
The concept integral_value<T> is satisfied if and only if T satisfies eve::value and the element type...
Definition value.hpp:51
The concept logical_value<T> is satisfied if and only if T satisfies eve::value and the element type ...
Definition value.hpp:132
The concept value<T> is satisfied if and only if T satisfies either eve::scalar_value or eve::simd_va...
Definition value.hpp:34
constexpr auto prev
Computes the nth previous representable element.
Definition prev.hpp:100
EVE Main Namespace.
Definition abi.hpp:18

Parameters

Return value

  1. the greatest representable value less than x is returned.
  2. the nth representable value less than x is returned. If n is zero returns x.
  3. The operation is performed conditionnaly
  4. if x is floating zero and mzero are considered distinct.
  5. ensures that the input is never less than the result of the call.
  6. works only if inputs are normal numbers (this excludes floating zeroes, denormals or not finite). the option has no influence on the two parameters calls

If n is zero returns x.

Example

// revision 0
#include <eve/module/core.hpp>
#include <iostream>
int main()
{
eve::wide wf0 = {-0.0f, 2.0f, eve::eps(eve::as<float>()), 0.0f, 30.0f,eve::mindenormal(eve::as<float>()),
eve::wide wi0 = {-1, 2, -3, -4, -32765, -32766, -32767, -32768 };
eve::wide wu0 = {0u, 1u, 2u, 3u, 4u, 5u, 6u, 7u};
std::cout << "<- wf0 = " << wf0 << "\n";
std::cout << "<- wi0 = " << wi0 << "\n";
std::cout << "<- wu0 = " << wu0 << "\n";
std::cout << "-> prev(wf0) = " << eve::prev(wf0) << "\n";
std::cout << "-> prev(wf0, wi1) = " << eve::prev(wf0, wu0) << "\n";
std::cout << "-> prev[ignore_last(2)](wf0) = " << eve::prev[eve::ignore_last(2)](wf0) << "\n";
std::cout << "-> prev[wf0 != 0](wf0) = " << eve::prev[wf0 != 0](wf0) << "\n";
std::cout << "-> prev[pedantic](wf0) = " << eve::prev[eve::pedantic](wf0) << "\n";
std::cout << "-> prev[saturated ](wi0) = " << eve::prev[eve::saturated ](wi0) << "\n";
std::cout << "-> prev(wu0) = " << eve::prev(wu0) << "\n";
std::cout << "-> prev(wi0) = " << eve::prev(wi0) << "\n";
std::cout << "-> prev(wi0, wu0) = " << eve::prev(wi0, wu0) << "\n";
}
constexpr auto nan
Computes the IEEE quiet NaN constant.
Definition nan.hpp:67
constexpr auto eps
Computes a constant to the machine epsilon.
Definition eps.hpp:73
constexpr auto mindenormal
Computes the smallest denormal positive value.
Definition mindenormal.hpp:70
constexpr auto minf
Computes the -infinity ieee value.
Definition minf.hpp:66
Lightweight type-wrapper.
Definition as.hpp:29
Conditional expression ignoring the k last lanes from a eve::simd_value.
Definition conditional.hpp:332
Wrapper for SIMD registers.
Definition wide.hpp:86