Avoiding a conversion over to floating point is necessary.
Asked
Active
Viewed 5,648 times
2 Answers
13
rust stable v1.61.0 branch: ceil(a/b)
is (a + b - 1) / b
if you know that that addition won't overflow.
Nightly: https://doc.rust-lang.org/std/primitive.i32.html#method.div_ceil

Dogunbound hounds
- 433
- 5
- 15