Skip to content

Commit

Permalink
Refactor 2_f32.powf(exponent) as exponent_f.exp2()
Browse files Browse the repository at this point in the history
Co-authored-by: Josh Stone <[email protected]>
  • Loading branch information
mtilda and cuviper authored Jun 27, 2024
1 parent d3935bf commit e8c766f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/float.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1875,7 +1875,7 @@ pub trait Float: Num + Copy + NumCast + PartialOrd + Neg<Output = Self> {
/// let exponent_f = exponent as f32;
///
/// // 1 * 11010048 * 2^(-18) == 42
/// 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();
///
/// assert!(abs_difference < 1e-10);
/// ```
Expand Down

0 comments on commit e8c766f

Please sign in to comment.