|
inlineconstexpr |
Computes the nearest integer to the input.
Defined in Header
Parameters
Return value
Computes elementwise the integer nearest to x
.
If x
is an exact half-integer the rounding is made to the nearest even integer.
The standard proposes 4 rounding modes namely: FE_TONEAREST
, FE_DOWNWARD
, FE_UPWARD
, FE_TOWARDZERO
. This function object implements the FE_TONEAREST
version.
For complex inputs the nearest operation is applied to both real and imaginary parts.
Masked Call
The call eve;nearest[mask](x)
provides a masked version of eve::nearest
which is equivalent to if_else (mask, nearest(x), x)
.
Example