summaryrefslogtreecommitdiff
path: root/utilities/utilities.go
blob: fd5c824e5996404595ad5d2b8a6a6abffdd0fafb (plain)
1
2
3
4
5
6
7
8
9
10
package utilities

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)
}