|
inlineconstexpr |
Parameters
Return value
The value of the arithmetic mean of the arguments is returned.
For two integral parameters half the sum of x and y. No overflow occurs. If 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.
However the dowward (respectively upward) options can be used to ensure the result is equivalent to the integral conversion of floor((x+y)/2), (respectively ceil((x+y)/2)).