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

◆ trunc

auto eve::trunc = functor<trunc_t>
inlineconstexpr

Header file

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
// Regular overload
constexpr auto trunc(value auto x) noexcept; // 1
// Lanes masking
constexpr auto trunc[conditional_expr auto c](value auto x) noexcept; // 2
constexpr auto trunc[logical_value auto m](value auto x) noexcept; // 2
// Semantic options
constexpr auto trunc[almost = tol](floating_value auto x) noexcept; // 3
constexpr auto trunc[almost](floating_value auto x) noexcept; // 4
constexpr auto trunc[raw](floating_value auto x) noexcept; // 5
}
Specifies that a type is a Conditional Expression.
Definition conditional.hpp:28
The concept floating_value<T> is satisfied if and only if T satisfies eve::value and the element type...
Definition value.hpp:116
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 trunc
elementwise_callable object computing the integral part of x with the same sign as x.
Definition trunc.hpp:91
EVE Main Namespace.
Definition abi.hpp:18

Parameters

Return value

  1. The integral part of x with the same sign as x. The standard proposes 4 rounding modes namely: FE_TONEAREST, FE_DOWNWARD, FE_UPWARD, FE_TOWARDZERO. This function object implements the FE_TOWARDZERO version.
  2. The operation is performed conditionnaly.
  3. almost allows a fuzzy interpretation of ceil associated to a scalar tolerance.
    • with an integral value tol: computes the ceil of the previous nth representable value in the x type.
    • with a floating value tol: computes the ceil with a tolerance tol.
  4. with no tolerance value, the call is equivalent to ceil[tolerance = 3*eps(as(x))(x)
  5. Faster for floating inputs, but only correct if as an integer, the truncation that can be exactly represented in the associated integral type.

External references