bend-kit-bignum
Search uses release 0.1.0.0 · 136 definitions
Definitions (136)
- type BigIntA magnitude is a list of base-10^4 limbs in U32, least significant first, with no zero limb on top.
- def Mag.ifA match cannot scrutinize a computed Bool, so each branch is a closure.
- def Mag.lone
- def Mag.consx + r * 10^4, dropping a zero limb on top.
- def Mag.norm
- def Mag.len
- def Mag.at
- def Mag.top
- def Mag.odd
- def Mag.incThe limbs are 0 or 1 in z: z says the carry c is 0, so a stays as is.
- def Mag.add
- def Mag.deca - w for the borrow w; z says w is 0.
- def Mag.suba - b - w for a >= b + w.
- def Mag.then
- def Mag.cmpBoth canonical, so the longer one is larger.
- def Mag.mul1a * m + c for m, c below 10^4.
- def Mag.scale
- def Mag.school.put
- def Mag.school
- def Mag.zeros
- def Mag.shiftxs * 10^(4 n).
- def Mag.lo
- def Mag.karaz0 + (s - z0 - z2) B^k + z2 B^2k, with B = 10^(4 k).
- def Mag.kmulKaratsuba while both sides have at least 32 limbs, schoolbook below.
- def Mag.mul
- def Mag.dsmallShort division of a big-endian list by d below 10^4 with remainder rem: the quotient comes out little-endian, with zero limbs on top.
- def Mag.half
- def Mag.fixKnuth's Algorithm D step D6: the estimate d is at most 2 over the true quotient digit, so f = 3 steps of p - bn always settle it.
- def Mag.stepOne quotient digit: bring limb x down into r, estimate from r's top two limbs over bn's top limb vt, and correct.
- def Mag.longLong division over the dividend's limbs, most significant first.
- def Mag.divmod.fin
- def Mag.divmoda / b and a % b for b above 0.
- def Mag.snd
- def Mag.rem
- def Mag.powb^e * acc by squaring; e <= f, and e halves as f counts down.
- def Mag.modpowb^e * acc mod m, with b and acc below m.
- def Mag.gcdEuclid.
- def Mag.dig
- def Mag.d4
- def Mag.showThe top limb unpadded, every lower limb as four digits.
- def Mag.digitsThe digit values of s, last first, and whether every char was a digit.
- def Mag.groupDigits, least significant first, four to a limb.
- def BigInt.mk
- def BigInt.zero
- def BigInt.one
- def BigInt.from_u32
- def BigInt.neg
- def BigInt.abs
- def BigInt.is_zero
- def BigInt.cmp
- def BigInt.add.mixedSigns differ: the larger magnitude keeps its sign.
- def BigInt.add.go
- def BigInt.add
- def BigInt.sub
- def BigInt.mul
- def BigInt.divmod.fin
- def BigInt.divmodTruncates toward zero: the remainder takes the dividend's sign.
- def BigInt.pow
- def Mag.baseThe base's residue in [0, m).
- def BigInt.modpow.go
- def BigInt.modpowb^e mod |m| in [0, |m|).
- def BigInt.gcdNever negative; gcd(0, 0) is 0.
- def BigInt.show
- def BigInt.read.fin
- def BigInt.readAn optional '-' and at least one ASCII digit; leading zeros are fine.
- type DecimalThe value is unscaled / 10^scale.
- def Decimal.zero
- def Decimal.pow10
- def Decimal.upu * 10^k, without a multiply when k is 0.
- def Decimal.neg
- def Decimal.abs
- def Decimal.is_zero
- def Decimal.add
- def Decimal.sub
- def Decimal.mul
- def Decimal.cmp
- def Decimal.quotThe quotient of a division whose divisor is known to be nonzero.
- def Decimal.divk.m(remainder is zero, quotient) of u / k, for a nonzero k.
- def Decimal.divk
- def Decimal.is_one
- def Decimal.lowest.fix
- def Decimal.lowest.den
- def Decimal.lowest.by
- def Decimal.lowestn / d in lowest terms with a positive denominator; d must be nonzero.
- def Decimal.frac.goEach step divides d by 2 or 5 and scales n to match, so a d of D digits needs fewer than 4D steps; f is that bound.
- def Decimal.frac.run
- def Decimal.frac.if
- def Decimal.from_fractionn / d at the smallest exact scale, or None when d is zero or the decimal expansion does not terminate (d has a prime factor other than 2 and 5).
- def Decimal.div_exacta / b exactly, at the smallest scale that holds it; None for a zero divisor or a repeating quotient (use Rational for those).
- def Decimal.normalize.go
- def Decimal.normalizeThe same value at the smallest scale: 1.500 is 1.5, 0.00 is 0.
- def Decimal.rescale.keep
- def Decimal.rescale.cut
- def Decimal.rescale.if
- def Decimal.rescaleThe same value at scale t, or None when that would drop a nonzero digit: rescale(1.5, 2n) is 1.50; rescale(1.25, 1n) is None, never 1.2 or 1.3.
- def Decimal.show.split
- def Decimal.show.pointDigits with a point s places from the right, zero-padded to one whole digit.
- def Decimal.show.sign
- def Decimal.showPlain notation with every scale digit: -12.50, 0.001, 7.
- type ClassA character of a number.