Percent Save

Simple library for calculate percentages in Go.

Project README

golang percent package

test workflow GoDoc Go Report Card

Calculate percentage in Golang.

Install

go get github.com/dariubs/percent

Usage

// 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

Documentation

GoDoc

License

MIT

Author

Dariush Abbasi (@dariubs )

Open Source Agenda is not affiliated with "Percent" Project. README Source: dariubs/percent
Stars
44
Open Issues
1
Last Commit
2 months ago
Repository
License
MIT

Open Source Agenda Badge

Open Source Agenda Rating