as days pass by

https://kryogenix.org/days

1 posts

Tech

Subscribe via RSS

  1. Calculating a rolling average without keeping all the numbers around

    OK, if you know anything about maths you will read this and shake your head in dismay because it's just obvious and why did I even need to think about it? But... I was quite pleased to think this through, so I thought I'd write it down in case anybody else finds it useful. So. Your job is to calculate the average of a set of numbers. This is not hard: the average value1 is the sum of the numbers divided by the count of the numbers. So the average of 2, 7, 8 is 2+7+8 17 ----- = -- = 5.666… ...

    0