Skip to main content

Module log_base_power_of_2

Module log_base_power_of_2 

Source
Expand description

LogBasePowerOf2 and LogBasePowerOf2Assign, traits for computing $\log_{2^k} x$ for Floats.

Functionsยง

primitive_float_log_base_power_of_2
Computes $\log_{2^k} x$, the base-$2^k$ logarithm of a primitive float, where the base is $2^k$ for some nonzero integer $k$. The exponent $k$ is pow, which may be negative. Using this function is more accurate than computing the logarithm using the standard library, whose log2 is not always correctly rounded.
primitive_float_log_base_power_of_2_rational
Computes $\log_{2^k} x$, the base-$2^k$ logarithm of a Rational, where the base is $2^k$ for some nonzero integer $k$, returning a primitive float result. The exponent $k$ is pow, which may be negative.