fast_math

Function exp2

Source
pub fn exp2(x: f32) -> f32
Expand description

Compute a fast approximation to 2x.

The maximum relative error for inputs for which the result is normal (x ≥ -128) is less than 0.011. For x < -128, the relative error in the (subnormal) result can be as large as 1.

If x is NaN, exp2 returns NaN.

See also exp2_raw which only works on -151 ≤ x ≤ 151, but is % faster.