From e8c766f3abf628ada7e8c1d88d530c5465d10339 Mon Sep 17 00:00:00 2001 From: Tilda <63630918+mtilda@users.noreply.github.com> Date: Thu, 27 Jun 2024 11:09:13 -0400 Subject: [PATCH] Refactor `2_f32.powf(exponent)` as `exponent_f.exp2()` Co-authored-by: Josh Stone --- src/float.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/float.rs b/src/float.rs index a0383c0..4124e92 100644 --- a/src/float.rs +++ b/src/float.rs @@ -1875,7 +1875,7 @@ pub trait Float: Num + Copy + NumCast + PartialOrd + Neg { /// 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); /// ```