replace powi with powf (/b/2785319+DT on linux)

This commit is contained in:
MaxOhn
2024-02-26 13:41:46 +01:00
parent 662e3d7689
commit 798cdcfa0a
8 changed files with 30 additions and 27 deletions
+1 -1
View File
@@ -78,7 +78,7 @@ impl Movement {
dist_addition += DIRECTION_CHANGE_BONUS / (self.last_strain_time + 16.0).sqrt()
* bonus_factor
* anti_flow_factor
* (1.0 - (weighted_strain_time / 1000.0).powi(3)).max(0.0);
* (1.0 - (weighted_strain_time / 1000.0).powf(3.0)).max(0.0);
}
dist_addition += 12.5
+2 -2
View File
@@ -472,7 +472,7 @@ impl CatchPerformanceInner {
let max_combo = attributes.max_combo();
// Relying heavily on aim
let mut pp = (5.0 * (stars / 0.0049).max(1.0) - 4.0).powi(2) / 100_000.0;
let mut pp = (5.0 * (stars / 0.0049).max(1.0) - 4.0).powf(2.0) / 100_000.0;
let mut combo_hits = self.combo_hits();
@@ -490,7 +490,7 @@ impl CatchPerformanceInner {
pp *= len_bonus;
// Penalize misses exponentially
pp *= 0.97_f64.powi(self.state.n_misses as i32);
pp *= 0.97_f64.powf(f64::from(self.state.n_misses));
// Combo scaling
if self.state.max_combo > 0 {
+4 -3
View File
@@ -186,12 +186,13 @@ impl DifficultyValues {
flashlight_rating *= 0.7;
}
let base_aim_performance = (5.0 * (aim_rating / 0.0675).max(1.0) - 4.0).powi(3) / 100_000.0;
let base_aim_performance =
(5.0 * (aim_rating / 0.0675).max(1.0) - 4.0).powf(3.0) / 100_000.0;
let base_speed_performance =
(5.0 * (speed_rating / 0.0675).max(1.0) - 4.0).powi(3) / 100_000.0;
(5.0 * (speed_rating / 0.0675).max(1.0) - 4.0).powf(3.0) / 100_000.0;
let base_flashlight_performance = if mods.fl() {
flashlight_rating.powi(2) * 25.0
flashlight_rating.powf(2.0) * 25.0
} else {
0.0
};
+8 -7
View File
@@ -199,20 +199,21 @@ impl AimEvaluator {
// * The maximum velocity we buff is equal to 125 / strainTime
* angle_bonus.min(125.0 / osu_curr_obj.strain_time)
// * scale buff from 150 bpm 1/4 to 200 bpm 1/4
* base1.powi(2)
* base1.powf(2.0)
// * Buff distance exceeding 50 (radius) up to 100 (diameter).
* base2.powi(2);
* base2.powf(2.0);
}
// * Penalize wide angles if they're repeated, reducing the penalty as the lastAngle gets more acute.
wide_angle_bonus *= angle_bonus
* (1.0 - wide_angle_bonus.min(Self::calc_wide_angle_bonus(last_angle).powi(3)));
* (1.0
- wide_angle_bonus.min(Self::calc_wide_angle_bonus(last_angle).powf(3.0)));
// * Penalize acute angles if they're repeated, reducing the penalty as the lastLastAngle gets more obtuse.
acute_angle_bonus *= 0.5
+ 0.5
* (1.0
- acute_angle_bonus
.min(Self::calc_acute_angle_bonus(last_last_angle).powi(3)));
.min(Self::calc_acute_angle_bonus(last_last_angle).powf(3.0)));
}
}
@@ -227,7 +228,7 @@ impl AimEvaluator {
// * Scale with ratio of difference compared to 0.5 * max dist.
let dist_ratio_base =
(FRAC_PI_2 * (prev_vel - curr_vel).abs() / prev_vel.max(curr_vel)).sin();
let dist_ratio = dist_ratio_base.powi(2);
let dist_ratio = dist_ratio_base.powf(2.0);
// * Reward for % distance up to 125 / strainTime for overlaps where velocity is still changing.
let overlap_vel_buff = (125.0 / osu_curr_obj.strain_time.min(osu_last_obj.strain_time))
@@ -238,7 +239,7 @@ impl AimEvaluator {
// * Penalize for rhythm changes.
let bonus_base = (osu_curr_obj.strain_time).min(osu_last_obj.strain_time)
/ (osu_curr_obj.strain_time).max(osu_last_obj.strain_time);
vel_change_bonus *= bonus_base.powi(2);
vel_change_bonus *= bonus_base.powf(2.0);
}
if osu_last_obj.base.is_slider() {
@@ -263,7 +264,7 @@ impl AimEvaluator {
fn calc_wide_angle_bonus(angle: f64) -> f64 {
(3.0 / 4.0 * ((5.0 / 6.0 * PI).min(angle.max(PI / 6.0)) - PI / 6.0))
.sin()
.powi(2)
.powf(2.0)
}
fn calc_acute_angle_bonus(angle: f64) -> f64 {
+1 -1
View File
@@ -201,7 +201,7 @@ impl FlashlightEvaluator {
last_obj = curr_obj;
}
result = (small_dist_nerf * result).powi(2);
result = (small_dist_nerf * result).powf(2.0);
// * Additional bonus for Hidden due to there being no approach circles.
if hidden {
+3 -3
View File
@@ -166,7 +166,7 @@ impl SpeedEvaluator {
let next_delta_time = osu_next_obj.delta_time.max(1.0);
let delta_diff = (next_delta_time - curr_delta_time).abs();
let speed_ratio = curr_delta_time / curr_delta_time.max(delta_diff);
let window_ratio = (curr_delta_time / hit_window).min(1.0).powi(2);
let window_ratio = (curr_delta_time / hit_window).min(1.0).powf(2.0);
doubletapness = speed_ratio.powf(1.0 - window_ratio);
}
@@ -178,7 +178,7 @@ impl SpeedEvaluator {
let speed_bonus = if strain_time < Self::MIN_SPEED_BONUS {
let base = (Self::MIN_SPEED_BONUS - strain_time) / Self::SPEED_BALANCING_FACTOR;
1.0 + 0.75 * base.powi(2)
1.0 + 0.75 * base.powf(2.0)
} else {
1.0
};
@@ -256,7 +256,7 @@ impl RhythmEvaluator {
// * fancy function to calculate rhythmbonuses.
let base = (PI / (prev_delta.min(curr_delta) / prev_delta.max(curr_delta))).sin();
let curr_ratio = 1.0 + 6.0 * base.powi(2).min(0.5);
let curr_ratio = 1.0 + 6.0 * base.powf(2.0).min(0.5);
let hit_window = u64::from(!curr_obj.base.is_spinner()) as f64 * hit_window;
+9 -8
View File
@@ -541,7 +541,7 @@ impl OsuPerformanceInner {
let (n100_mult, n50_mult) = if self.attrs.od > 0.0 {
(
1.0 - (self.attrs.od / 13.33).powf(1.8),
1.0 - (self.attrs.od / 13.33).powi(5),
1.0 - (self.attrs.od / 13.33).powf(5.0),
)
} else {
(1.0, 1.0)
@@ -580,7 +580,7 @@ impl OsuPerformanceInner {
}
fn compute_aim_value(&self) -> f64 {
let mut aim_value = (5.0 * (self.attrs.aim / 0.0675).max(1.0) - 4.0).powi(3) / 100_000.0;
let mut aim_value = (5.0 * (self.attrs.aim / 0.0675).max(1.0) - 4.0).powf(3.0) / 100_000.0;
let total_hits = self.total_hits();
@@ -628,7 +628,7 @@ impl OsuPerformanceInner {
))
.clamp(0.0, estimate_diff_sliders);
let slider_nerf_factor = (1.0 - self.attrs.slider_factor)
* (1.0 - estimate_slider_ends_dropped / estimate_diff_sliders).powi(3)
* (1.0 - estimate_slider_ends_dropped / estimate_diff_sliders).powf(3.0)
+ self.attrs.slider_factor;
aim_value *= slider_nerf_factor;
@@ -636,7 +636,7 @@ impl OsuPerformanceInner {
aim_value *= self.acc;
// * It is important to consider accuracy difficulty when scaling with accuracy.
aim_value *= 0.98 + self.attrs.od.powi(2) / 2500.0;
aim_value *= 0.98 + self.attrs.od.powf(2.0) / 2500.0;
aim_value
}
@@ -647,7 +647,7 @@ impl OsuPerformanceInner {
}
let mut speed_value =
(5.0 * (self.attrs.speed / 0.0675).max(1.0) - 4.0).powi(3) / 100_000.0;
(5.0 * (self.attrs.speed / 0.0675).max(1.0) - 4.0).powf(3.0) / 100_000.0;
let total_hits = self.total_hits();
@@ -737,7 +737,8 @@ impl OsuPerformanceInner {
// * Lots of arbitrary values from testing.
// * Considering to use derivation from perfect accuracy in a probabilistic manner - assume normal distribution.
let mut acc_value = 1.52163_f64.powf(self.attrs.od) * better_acc_percentage.powi(24) * 2.83;
let mut acc_value =
1.52163_f64.powf(self.attrs.od) * better_acc_percentage.powf(24.0) * 2.83;
// * Bonus for many hitcircles - it's harder to keep good accuracy up for longer.
acc_value *= (f64::from(amount_hit_objects_with_acc) / 1000.0)
@@ -761,7 +762,7 @@ impl OsuPerformanceInner {
return 0.0;
}
let mut flashlight_value = self.attrs.flashlight.powi(2) * 25.0;
let mut flashlight_value = self.attrs.flashlight.powf(2.0) * 25.0;
let total_hits = self.total_hits();
@@ -784,7 +785,7 @@ impl OsuPerformanceInner {
// * Scale the flashlight value with accuracy _slightly_.
flashlight_value *= 0.5 + self.acc / 2.0;
// * It is important to also consider accuracy difficulty when doing that.
flashlight_value *= 0.98 + self.attrs.od.powi(2) / 2500.0;
flashlight_value *= 0.98 + self.attrs.od.powf(2.0) / 2500.0;
flashlight_value
}
+2 -2
View File
@@ -465,7 +465,7 @@ impl TaikoPerformanceInner {
let acc = self.custom_accuracy();
diff_value * acc.powi(2)
diff_value * acc.powf(2.0)
}
fn compute_accuracy_value(&self) -> f64 {
@@ -474,7 +474,7 @@ impl TaikoPerformanceInner {
}
let mut acc_value = (60.0 / self.attrs.hit_window).powf(1.1)
* self.custom_accuracy().powi(8)
* self.custom_accuracy().powf(8.0)
* self.attrs.stars.powf(0.4)
* 27.0;