Might not be a good idea, but testing this.

This commit is contained in:
2018-10-17 20:02:14 +02:00
parent fd228caaf7
commit 2651a44893

View File

@@ -1,11 +1,14 @@
#[inline(always)]
pub fn rating(a: f32, b: f32, score: f32, n: f32, k: f32) -> f32 { pub fn rating(a: f32, b: f32, score: f32, n: f32, k: f32) -> f32 {
a + delta(score, expected(a, b, n), k) a + delta(score, expected(a, b, n), k)
} }
#[inline(always)]
fn delta(score: f32, rating: f32, k: f32) -> f32 { fn delta(score: f32, rating: f32, k: f32) -> f32 {
k * (score - rating) k * (score - rating)
} }
#[inline(always)]
fn expected(a: f32, b: f32, n: f32) -> f32 { fn expected(a: f32, b: f32, n: f32) -> f32 {
1.0 / (1.0 + 10.0_f32.powf((b - a) / n)) 1.0 / (1.0 + 10.0_f32.powf((b - a) / n))
} }