From 2651a44893e24bb4e5a9fee7cb5143136ebbb569 Mon Sep 17 00:00:00 2001 From: Anders Olsson Date: Wed, 17 Oct 2018 20:02:14 +0200 Subject: [PATCH] Might not be a good idea, but testing this. --- src/lib.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index a3cede6..df114d5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,11 +1,14 @@ +#[inline(always)] pub fn rating(a: f32, b: f32, score: f32, n: f32, k: f32) -> f32 { a + delta(score, expected(a, b, n), k) } +#[inline(always)] fn delta(score: f32, rating: f32, k: f32) -> f32 { k * (score - rating) } +#[inline(always)] fn expected(a: f32, b: f32, n: f32) -> f32 { 1.0 / (1.0 + 10.0_f32.powf((b - a) / n)) }