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

◆ prevint

auto eve::prevint = functor<prevint_t>
inlineconstexpr

This function is equivalent to dec for integral types. For floating point types, it will skip over the non-representable values between the input and the previous representable integer.

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
// Regular overloads
constexpr auto prevint(value auto x) noexcept; // 1
// Lanes masking
constexpr auto prevint[conditional_expr auto c](/* any of the above overloads */) noexcept; // 2
constexpr auto prevint[logical_value auto m](/* any of the above overloads */) noexcept; // 2
// Exclusive Semantic options - Only one of those can be set at once
constexpr auto prevint[raw](value auto x) noexcept; // 3
constexpr auto prevint[saturated](value auto x) noexcept; // 4
}
Specifies that a type is a Conditional Expression.
Definition conditional.hpp:28
The concept logical_value<T> is satisfied if and only if T satisfies eve::value and the element type ...
Definition value.hpp:134
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 saturated
Keeps the result inside the range of its type instead of wrapping or overflowing.
Definition core.hpp:104
constexpr auto raw
Performs the operation minimally, trading accuracy for speed.
Definition core.hpp:95
constexpr auto prevint
Computes the previous representable integer if it exists.
Definition prevint.hpp:83
EVE Main Namespace.
Definition abi.hpp:19

Parameters

Return value

  1. The greatest representable integer value less than x is returned.
  2. The operation is performed conditionally
  3. same as 1. but inf returns nan.
  4. ensures that the input is never less than the result of the call. (It can be equal for minimal representable value)

Example

#include <eve/eve.hpp>
#include <iostream>
int main()
{
static_cast<eve::float16_t>(-0.0f),
static_cast<eve::float16_t>(0.0f),
static_cast<eve::float16_t>(32768.0f),
static_cast<eve::float16_t>(-32768.0f),
};
std::cout << "<- w = " << w << "\n";
std::cout << "-> prevint(w) = " << eve::prevint(w) << "\n";
std::cout << "-> prevint[saturated](w) = " << eve::prevint[eve::saturated](w) << "\n";
std::cout << "-> prevint[raw](w) = " << eve::prevint[eve::raw](w) << "\n";
eve::wide<std::int16_t, eve::fixed<4>> iw{0, 1, 32767, -32768};
std::cout << "<- iw = " << iw << "\n";
std::cout << "-> prevint(iw) = " << eve::prevint(iw) << "\n";
std::cout << "-> prevint[saturated](iw) = " << eve::prevint[eve::saturated](iw) << "\n";
std::cout << "-> prevint[raw](iw) = " << eve::prevint[eve::raw](iw) << "\n";
}
constexpr auto valmin
Computes the lowest representable value.
Definition valmin.hpp:67
constexpr auto nan
Computes the IEEE quiet NaN constant.
Definition nan.hpp:67
constexpr auto inf
Computes the infinity ieee value.
Definition inf.hpp:67
constexpr auto minf
Computes the -infinity ieee value.
Definition minf.hpp:67
Lightweight type-wrapper.
Definition as.hpp:29
IEEE 754 binary16 floating-point type.
Definition float16.hpp:189
Wrapper for SIMD registers.
Definition wide.hpp:94