summaryrefslogtreecommitdiff
path: root/ma/ma.go
diff options
context:
space:
mode:
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
}
}