diff options
Diffstat (limited to 'utilities/utilities.go')
| -rw-r--r-- | utilities/utilities.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/utilities/utilities.go b/utilities/utilities.go index a372141..fd5c824 100644 --- a/utilities/utilities.go +++ b/utilities/utilities.go @@ -1,5 +1,10 @@ package utilities -func PercentDifference(current float64, previous float64) (difference float64) { +import "math" + +func SignedPercentDifference(current float64, previous float64) (difference float64) { return ((current - previous) / (float64(current+previous) / 2.0)) * float64(100) } +func AbsPercentDifference(current float64, previous float64) (difference float64) { + return (math.Abs(current-previous) / (float64(current+previous) / 2.0)) * float64(100) +} |
