ieeeMean

Return the value that lies halfway between x and y on the IEEE number line.

Formally, the result is the arithmetic mean of the binary significands of x and y, multiplied by the geometric mean of the binary exponents of x and y. x and y must have the same sign, and must not be NaN. Note: this function is useful for ensuring O(log n) behaviour in algorithms involving a 'binary chop'.

Special cases: If x and y are within a factor of 2, (ie, feqrel(x, y) > 0), the return value is the arithmetic mean (x + y) / 2. If x and y are even powers of 2, the return value is the geometric mean, ieeeMean(x, y) = sqrt(x * y).

T
ieeeMean
(
T
)
(
T x
,
T y
)

Meta