add some func
This commit is contained in:
parent
63f769796f
commit
d598fb5ce5
@ -100,6 +100,10 @@ func Divide[T constraints.Integer | constraints.Float](i, j T) T {
|
|||||||
return i / j
|
return i / j
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Ceil[T constraints.Integer](num1, num2 T) int {
|
||||||
|
return int((num1 + num2 - 1) / num2)
|
||||||
|
}
|
||||||
|
|
||||||
func DivideCeil[T constraints.Integer](num1, num2 T) T {
|
func DivideCeil[T constraints.Integer](num1, num2 T) T {
|
||||||
return T(math.Ceil(float64(num1) / float64(num2)))
|
return T(math.Ceil(float64(num1) / float64(num2)))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user