Skip to content

Commit e8c766f

Browse files
mtildacuviper
andauthored
Refactor 2_f32.powf(exponent) as exponent_f.exp2()
Co-authored-by: Josh Stone <[email protected]>
1 parent d3935bf commit e8c766f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/float.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1875,7 +1875,7 @@ pub trait Float: Num + Copy + NumCast + PartialOrd + Neg<Output = Self> {
18751875
/// let exponent_f = exponent as f32;
18761876
///
18771877
/// // 1 * 11010048 * 2^(-18) == 42
1878-
/// let abs_difference = (sign_f * mantissa_f * 2_f32.powf(exponent_f) - num).abs();
1878+
/// let abs_difference = (sign_f * mantissa_f * exponent_f.exp2() - num).abs();
18791879
///
18801880
/// assert!(abs_difference < 1e-10);
18811881
/// ```

0 commit comments

Comments
 (0)