pct diff function
This commit is contained in:
parent
c7170a2650
commit
b15c99f695
1 changed files with 6 additions and 0 deletions
6
util.go
6
util.go
|
@ -135,3 +135,9 @@ func Seq(start, end float64, steps ...float64) []float64 {
|
|||
}
|
||||
return values
|
||||
}
|
||||
|
||||
// PercentageDifference computes the percentage difference between two values.
|
||||
// The formula is (v2-v1)/v1.
|
||||
func PercentageDifference(v1, v2 float64) float64 {
|
||||
return (v2 - v1) / v1
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue