diff options
| author | Will Hawkins <[email protected]> | 2021-12-14 00:55:29 -0500 |
|---|---|---|
| committer | Will Hawkins <[email protected]> | 2021-12-14 00:55:29 -0500 |
| commit | 728a81b8205678abeeb54a69e9e26ee06c18b607 (patch) | |
| tree | 00ee2efb388f96a4e7612f3c4cb7b086f7e8bc0c /ma/ma.go | |
| parent | 4c9a70fe1c7e7596eebaf475cf78596eee614c7e (diff) | |
Refactoring -- more.
Diffstat (limited to 'ma/ma.go')
| -rw-r--r-- | ma/ma.go | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -4,6 +4,7 @@ import ( "math" "github.com/hawkinsw/goresponsiveness/saturating" + "github.com/hawkinsw/goresponsiveness/utilities" ) // Convert this to a Type Parameterized interface when they are available @@ -37,9 +38,7 @@ func (ma *MovingAverage) ConsistentWithin(limit float64) bool { previous := ma.instants[0] for i := 1; i < ma.intervals; i++ { current := ma.instants[i] - delta := math.Abs(current - previous) - percentChange := (float64(delta) / (float64(current+previous) / 2.0)) * float64(100) - + percentChange := utilities.AbsPercentDifference(current, previous) previous = current if math.Abs(percentChange) > limit { return false |
