blob: 54f0f4ad7a436c735eb258ebc2692576b8bb5ea2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
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)
}
func Conditional(condition bool, t string, f string) string {
if condition {
return t
}
return f
}
|