From 728a81b8205678abeeb54a69e9e26ee06c18b607 Mon Sep 17 00:00:00 2001 From: Will Hawkins Date: Tue, 14 Dec 2021 00:55:29 -0500 Subject: Refactoring -- more. --- utilities/utilities.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'utilities') 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) +} -- cgit v1.2.3