

A fast Go library for exponential moving averages - poteland
https://vividcortex.com/blog/2013/07/23/a-fast-go-library-for-exponential-moving-averages/

======
skybrian
This is a special case of a digital filter where the weights are set to an
exponential function. Apparently you can do things like tune for particular
frequencies. It's a whole subfield in itself, but I found this a good
introduction:

[http://www.dspguide.com/pdfbook.htm](http://www.dspguide.com/pdfbook.htm)

------
IanCal
I've submitted a pull request as there's a bug dealing with the initialisation
of the average.

If the value is 0, you're assuming it's uninitialised, but that's not true. A
sequence of 0,0,0,0,0,0,1 is valid and should not have a final moving average
of 1.

More generally, it's a really bad idea to encode information in numbers like
this.

