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 /utilities/utilities.go | |
| parent | 4c9a70fe1c7e7596eebaf475cf78596eee614c7e (diff) | |
Refactoring -- more.
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) +} |
