Moving average implementation for Go. Moving average is used, among other things, to smooth out outliers in measurement results.
package main
import (
"simonwaldherr.de/go/movingavg"
"fmt"
)
func main() {
ma := movingavg.New(3)
ma.Add(1)
ma.Add(2)
ma.Add(3)
ma.Add(5)
fmt.Printf("Avg: %d", ma.Arithmetic())
}