sort example: percentage edge case check
Vladimir Bauer
9 years ago
| 34 | 34 |
}
|
| 35 | 35 |
|
| 36 | 36 |
func percentage(total, current int64, ratio int) int {
|
| 37 | |
if total <= 0 {
|
|
37 |
if total == 0 || current > total {
|
| 38 | 38 |
return 0
|
| 39 | 39 |
}
|
| 40 | 40 |
return int(float64(ratio) * float64(current) / float64(total))
|