We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2_f32.powf(exponent)
exponent_f.exp2()
1 parent d3935bf commit e8c766fCopy full SHA for e8c766f
src/float.rs
@@ -1875,7 +1875,7 @@ pub trait Float: Num + Copy + NumCast + PartialOrd + Neg<Output = Self> {
1875
/// let exponent_f = exponent as f32;
1876
///
1877
/// // 1 * 11010048 * 2^(-18) == 42
1878
- /// let abs_difference = (sign_f * mantissa_f * 2_f32.powf(exponent_f) - num).abs();
+ /// let abs_difference = (sign_f * mantissa_f * exponent_f.exp2() - num).abs();
1879
1880
/// assert!(abs_difference < 1e-10);
1881
/// ```
0 commit comments