From bcbb38871de9c83d6a237f12d2ba855406210edb Mon Sep 17 00:00:00 2001 From: MaxOhn Date: Thu, 26 Dec 2024 18:23:17 +0100 Subject: [PATCH] refactor: alternative exp function call --- src/osu/difficulty/skills/speed.rs | 2 +- src/taiko/difficulty/skills/stamina.rs | 2 +- src/util/special_functions.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/osu/difficulty/skills/speed.rs b/src/osu/difficulty/skills/speed.rs index f596450b..a6e0dfc8 100644 --- a/src/osu/difficulty/skills/speed.rs +++ b/src/osu/difficulty/skills/speed.rs @@ -73,7 +73,7 @@ impl Speed { .object_strains .iter() .fold(0.0, |sum, strain| { - sum + (1.0 + (-(strain / max_strain * 12.0 - 6.0)).exp()).recip() + sum + (1.0 + f64::exp(-(strain / max_strain * 12.0 - 6.0))).recip() }) }) } diff --git a/src/taiko/difficulty/skills/stamina.rs b/src/taiko/difficulty/skills/stamina.rs index 7e3300af..16c82172 100644 --- a/src/taiko/difficulty/skills/stamina.rs +++ b/src/taiko/difficulty/skills/stamina.rs @@ -121,7 +121,7 @@ impl Skill<'_, Stamina> { .unwrap_or(0); if self.inner.single_color { - self.curr_strain() / (1.0 + ((-(index as isize - 10)) as f64 / 2.0).exp()) + self.curr_strain() / (1.0 + f64::exp((-(index as isize - 10)) as f64 / 2.0)) } else { self.curr_strain() } diff --git a/src/util/special_functions.rs b/src/util/special_functions.rs index 1e5754f2..3d5abc23 100644 --- a/src/util/special_functions.rs +++ b/src/util/special_functions.rs @@ -195,7 +195,7 @@ fn erf_imp(z: f64, mut invert: bool) -> f64 { ) }; - let g = (-z * z).exp() / z; + let g = f64::exp(-z * z) / z; (g * b) + (g * r) } else {