Basic module

unsigned_divide_with_remainder

procedureSource

Divides u by v. The third result is true when v is zero, and the others are then U128_ERROR.

unsigned_divide_with_remainder :: (
    u: U128,
    v: U128
) -> (quotient: U128, remainder: U128, overflow_or_divide_by_zero: bool)

Parameters

u: U128
v: U128

Returns

quotient: U128
remainder: U128
overflow_or_divide_by_zero: bool
Example↗
q, r, error := unsigned_divide_with_remainder(to_u128(cast(u64) 100), to_u128(cast(u64) 7));
assert(!error && q.low == 14 && r.low == 2);

See also