|
inlineconstexpr |
Computes the arithmetic mean of its arguments.
Defined in Header
Parameters
Return value
The value of the arithmetic mean of the arguments is returned.
x
and y
. No overflow occurs.x
and y
are integral values and the sum is odd, the result is a rounded value at a distance guaranteed to be less than or equal to 0.5 of the average floating value, but may differ by unity from the truncation given by (x+y)/2
. Moreover, as some architectures provide simd intrinsics to perform the operation, the scalar results may differ by one unit from simd ones which are system dependent.Masked Call
The call eve::average[mask](x, ...)
provides a masked version of average
which is equivalent to if_else(mask, average(x, ...), x)
Example
when raw(average)(x, args, ...)
is used, no provision is made to avoid overflows for more than 2 parameters.
Example