def BigInt.divmod

bend-kit-bignum@0.1.0.0 · bigint.bend:419

import bend-kit-bignum@0.1.0.0/bigint.bend as Bigint
import Base

419# Truncates toward zero: the remainder takes the dividend's sign.
420def BigInt.divmod(a: BigInt, b: BigInt) -> Maybe<&1, BigInt & BigInt>:
421  match a b:
422    case BigInt{sa, x} BigInt{sb, Nil{}}:
423      None{}
424    case BigInt{sa, x} BigInt{sb, y}:
425      Some{BigInt.divmod.fin(sa, sb, Mag.divmod(x, y))}

Uses (6)

Used by (3)