pub fn log2_raw(x: f32) -> f32
Expand description
Compute a fast approximation of the base-2 logarithm of positive,
finite, non-denormal x
.
This will return unspecified nonsense if x
is doesn’t not
satisfy those constraints. Use log2
if correct handling is
required (at the expense of some speed).
The maximum relative error across all valid input is less than 0.022. The maximum absolute error is less than 0.009.
Time (ns) | |
---|---|
x.log2() | 14.3 |
log2(x) | 4.0 |
log2_raw(x) | 2.7 |