def digit_fin
import bend-collections@1.0.0.0/src/math/f64.bend as F64import Base
import bend-collections@1.0.0.0/src/math/u64.bend as W
import bend-collections@1.0.0.0/src/math/w64.bend as X
366# the next quotient digit of r * 2^32 / b (r < b, b >= 2^52) and the remainder
367def digit_fin(+r: W.U64, +b: W.U64, +d: U32) -> U32 & W.U64:
368 (d, X.sub(W.U64{0, X.lo(r)}, X.fst_q(X.mul_32_64(d, b))))