From bbdc2c296a71d7738309a74b309ad2600af8a657 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Fri, 1 Mar 2024 23:23:29 +0200 Subject: gnosis-algorithm-next-ef: Adjust for 0 If c-successes/c-failures is 0 change-p would return t, triggering the update frequency. Using max 1 would fixes this. --- gnosis-algorithm.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gnosis-algorithm.el b/gnosis-algorithm.el index 64c08c3..be91c53 100644 --- a/gnosis-algorithm.el +++ b/gnosis-algorithm.el @@ -124,7 +124,7 @@ reviews, increase the ef increase value (first item) by INCREASE. For every FREQUENCY of C-FAILURES reviews, decrease the ef decrease value (second item) by DECREASE." - (let ((change-p (= (% (if success c-successes c-failures) frequency) 0)) + (let ((change-p (= (% (max 1 (if success c-successes c-failures)) frequency) 0)) (new-ef (if success (gnosis-algorithm-replace-at-index 2 (+ (nth 2 ef) (nth 0 ef)) ef) (gnosis-algorithm-replace-at-index 2 (max 1.3 (- (nth 2 ef) (nth 1 ef))) ef)))) (cond ((and success change-p) -- cgit v1.2.3