Skip to main content
Ben Nadel
On User Experience (UX) Design, JavaScript, ColdFusion, Node.js, Life, and Love.


Member since Dec 20, 2012

Recent Blog Comments By oleg

  • Create A Running Average Without Storing Individual Values

    Posted on Dec 20, 2012 at 5:36 PM

    If you are afraid to overflow Sum, here's an equivalent formula: M_0 = 0 M_{i+1} = M_i + (x_{i+1} - M_i)/(i+1) In pseudo-code: n = M = 0 ... n = n + 1 M = M + (x-M)/n Here M is the (cumulative moving) average, x is the new value in the sequence, n is the count of values. The dow... read more »