]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - mood.c
mood.c: Avoid integer overflow.
[paraslash.git] / mood.c
diff --git a/mood.c b/mood.c
index 8e6a7665f15e32bc5774c5539358ccaf0bcbc880..e026c960d5fd878cdca6350f3e74a40b85c338f8 100644 (file)
--- a/mood.c
+++ b/mood.c
@@ -472,7 +472,7 @@ static int64_t normalized_value(int64_t x, int64_t n, int64_t sum, int64_t qd)
 {
        if (!n || !qd)
                return 0;
-       return 100 * (n * x - sum) / (int64_t)int_sqrt(n * qd);
+       return 100 * (n * x - sum) / (int64_t)int_sqrt(n) / (int64_t)int_sqrt(qd);
 }
 
 static long compute_num_played_score(struct afs_info *afsi)