phobos/changelog/std-bigint-divmod.dd
2018-01-28 14:24:15 +01:00

18 lines
No EOL
384 B
Text

`divMod` was added to std.bigint.
$(REF divMod, std, bigint) calculates both the quotient and the remainder in one go:
-----
void divMod(const BigInt dividend, const BigInt divisor, out BigInt quotient, out BigInt remainder) pure nothrow
{
auto a = BigInt(123);
auto b = BigInt(25);
BigInt q, r;
divMod(a, b, q, r);
assert(q == 4);
assert(r == 23);
assert(q * b + r == a);
}
-----