def BigInt.gcd

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

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

460# Never negative; gcd(0, 0) is 0.
461def BigInt.gcd(a: BigInt, b: BigInt) -> BigInt:
462  match a b:
463    case BigInt{sa, +x} BigInt{sb, +y}:
464      BigInt{False{}, Mag.gcd(
465        Nat.add(Nat.mul(Nat.add(Mag.len(x), Mag.len(y)), 20n), 2n), x, y)}

Uses (6)

Used by (1)