E.V.E
v2023.02.15
Loading...
Searching...
No Matches
◆
trunc
auto eve::trunc =
functor
<trunc_t>
inline
constexpr
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
}
eve::conditional_expr
Specifies that a type is a Conditional Expression.
Definition
conditional.hpp:28
eve::floating_value
The concept floating_value<T> is satisfied if and only if T satisfies eve::value and the element type...
Definition
value.hpp:116
eve::logical_value
The concept logical_value<T> is satisfied if and only if T satisfies eve::value and the element type ...
Definition
value.hpp:134
eve::value
The concept value<T> is satisfied if and only if T satisfies either eve::scalar_value or eve::simd_va...
Definition
value.hpp:34
eve::trunc
constexpr auto trunc
elementwise_callable object computing the integral part of x with the same sign as x.
Definition
trunc.hpp:91
eve
EVE Main Namespace.
Definition
abi.hpp:19
Parameters
x
:
value
argument.
c
:
Conditional expression
masking the operation.
m
:
Logical value
masking the operation.
tol
scalar_value
tolerance.
Return value
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.
The operation is performed conditionnaly
.
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
.
with no tolerance value, the call is equivalent to
ceil
[tolerance = 3*eps(as(x))(x)
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
C++ standard reference
eve