The OpenD Programming Language

divMod

Finds the quotient and remainder for the given dividend and divisor in one operation.

pure nothrow @safe
void
divMod

Parameters

dividend BigInt

the BigInt to divide

divisor BigInt

the BigInt to divide the dividend by

quotient BigInt

is set to the result of the division

remainder BigInt

is set to the remainder of the division

Examples

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);

Meta