Skip to main content

Module log_base_2_1_plus_x

Module log_base_2_1_plus_x 

Source
Expand description

LogBase2Of1PlusX and LogBase2Of1PlusXAssign, traits for computing $\log_2(1+x)$ for Floats.

Functions§

primitive_float_log_base_2_1_plus_x
Computes the base-2 logarithm of one plus a primitive float, $\log_2(1+x)$. Using this function is more accurate than computing (1 + x).log2(), both because $1+x$ may not be representable as a primitive float and because the standard library’s log2 is not always correctly rounded.