def eg_up

bend-collections-laws-math@1.0.0.0 · src/math/number.bend:40

import bend-collections-laws-math@1.0.0.0/src/math/number.bend as Number
import Base

40# From the child (b, a mod b) to the parent (a, b): with q = a div b the
41# coefficients become (y', x' + q*y') and the sign flips (Knuth 4.5.2,
42# algorithm X, in magnitudes).
43def eg_up(+q: Nat, r: EGcd) -> EGcd:
44  match r:
45    case EG{+g, +x, +y, neg}:
46      EG{g, y, Nat.add(x, Nat.mul(q, y)), Bool.not(neg)}

Uses (5)

Used by (5)