123456789101112131415161718192021222324252627282930 |
- package utility
- func Min(a, b int64) int64 {
- if a < b {
- return a
- }
- return b
- }
- func Max(a, b int64) int64 {
- if a > b {
- return a
- }
- return b
- }
- func Sequential(now, old float64) float64 {
- if old == 0 {
- return old
- }
- return (now - old) / old
- }
- // 计算公式
- func Formula(current, total float64) (result float64) {
- if total == 0 {
- return 0
- }
- result = current / total
- return
- }
|