ceildiv

Returns the result of ceil(a / b) but uses integer arithmetic only.

Integer
ceildiv
pure nothrow
(
Integer
)
(
in Integer a
,
in Integer b
)
if (
isIntegral!Integer
)

Examples

1 assert(ceildiv(0, 3) == 0);
2 assert(ceildiv(1UL, 3UL) == 1UL);
3 assert(ceildiv(2L, 3L) == 1L);
4 assert(ceildiv(3U, 3U) == 1U);
5 assert(ceildiv(4, 3) == 2);
6 assert(ceildiv(-4, 4) == -1);
7 assert(ceildiv(-4, 3) == -1);

Meta