summaryrefslogtreecommitdiff
path: root/ma/ma.go
diff options
context:
space:
mode:
authorWill Hawkins <[email protected]>2021-12-15 23:44:19 -0500
committerWill Hawkins <[email protected]>2021-12-15 23:44:19 -0500
commitc24e70fd98bb61ddf735a7f54e278258f2dfc990 (patch)
treedfa9ffba2f46ec7269d77915f7c1cd1739c81e9f /ma/ma.go
parentb74e4d4261d8618ef5f99118d2b784cde2614ca2 (diff)
More general work.
Diffstat (limited to 'ma/ma.go')
-rw-r--r--ma/ma.go8
1 files changed, 3 insertions, 5 deletions
diff --git a/ma/ma.go b/ma/ma.go
index 5c3558b..b591d19 100644
--- a/ma/ma.go
+++ b/ma/ma.go
@@ -1,8 +1,6 @@
package ma
import (
- "math"
-
"github.com/hawkinsw/goresponsiveness/saturating"
"github.com/hawkinsw/goresponsiveness/utilities"
)
@@ -34,13 +32,13 @@ func (ma *MovingAverage) CalculateAverage() float64 {
return float64(total) / float64(ma.divisor.Value())
}
-func (ma *MovingAverage) ConsistentWithin(limit float64) bool {
+func (ma *MovingAverage) IncreasesLessThan(limit float64) bool {
previous := ma.instants[0]
for i := 1; i < ma.intervals; i++ {
current := ma.instants[i]
- percentChange := utilities.AbsPercentDifference(current, previous)
+ percentChange := utilities.SignedPercentDifference(current, previous)
previous = current
- if math.Abs(percentChange) > limit {
+ if percentChange > limit {
return false
}
}