Calculate percentage in Golang.
go get github.com/dariubs/percent
// Percent - calculate what %[number1] of [number2] is.
percent.Percent(25, 200) // return 50
percent.PercentFloat(25.0, 200.0) // return 50.0
// PercentOf - calculate what percent [number1] is of [number2].
percent.PercentOf(300, 2400) // return 12.5
percent.PercentOfFloat(300.0, 2400.0) // return 12.5
// Change - calculate the percent increase/decrease from two numbers.
percent.Change(20, 60) // return 200.0
percent.ChangeFloat(20.0, 60.0) // return 200.0
MIT
Dariush Abbasi (@dariubs )