You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
333 B
Go
15 lines
333 B
Go
package nmath
|
|
|
|
// IsNumeric returns true if the given character is a numeric, otherwise false.
|
|
func IsNumeric(c byte) bool {
|
|
return c >= '0' && c <= '9'
|
|
}
|
|
|
|
// Percent returns a values percent of the total
|
|
func Percent(val, total int) float64 {
|
|
if total == 0 {
|
|
return float64(0)
|
|
}
|
|
return (float64(val) / float64(total)) * 100
|
|
}
|