From: wessels <> Date: Mon, 25 Aug 1997 21:49:04 +0000 (+0000) Subject: doubleAverage() algorithm was wrong. X-Git-Tag: SQUID_3_0_PRE1~4814 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1d8e0d400da1a5af2d417c73afc07198b346b314;p=thirdparty%2Fsquid.git doubleAverage() algorithm was wrong. --- diff --git a/src/tools.cc b/src/tools.cc index f0a8bc5f9e..2e6bee2c45 100644 --- a/src/tools.cc +++ b/src/tools.cc @@ -1,6 +1,6 @@ /* - * $Id: tools.cc,v 1.117 1997/07/16 20:32:21 wessels Exp $ + * $Id: tools.cc,v 1.118 1997/08/25 15:49:04 wessels Exp $ * * DEBUG: section 21 Misc Functions * AUTHOR: Harvest Derived @@ -744,11 +744,11 @@ inaddrFromHostent(const struct hostent *hp) } double -doubleAverage(double cur, double new, int n, int max) +doubleAverage(double cur, double new, int N, int max) { - if (n > max) - n = max; - return (cur * (n - 1)) + new / n; + if (N > max) + N = max; + return (cur * (N - 1.0) + new) / N; } int