sumOfLogs

Compute the sum of binary logarithms of the input range r. The error of this method is much smaller than with a naive sum of log.

Unqual!(DeepElementType!Range)
sumOfLogs
(
Range
)
(
Range r
)
if (
isFloatingPoint!(DeepElementType!Range)
)

Examples

import mir.math: LN2, approxEqual;
assert([ 0.25, 0.25, 0.25, 0.125 ].sumOfLogs.approxEqual(-9 * double(LN2)));