Function fast_math::log2 [−][src]
pub fn log2(x: f32) -> f32
Compute a fast approximation of the base-2 logarithm of x.
The maximum relative error across all positive f32s (including denormals) is less than 0.022. The maximum absolute error is less than 0.009.
If x is negative, or NaN, log2 returns NaN.
See also log2_raw which only works on positive, finite,
non-denormal floats, but is 30-40% faster.
| Time (ns) | |
|---|---|
x.log2() | 14.3 |
log2(x) | 4.0 |
log2_raw(x) | 2.7 |