W64.est_lo: def of bend-collections@1.0.0.0 Import: import bend-collections@1.0.0.0/src/math/w64.bend as W64 Lines 320-325 of bend-collections@1.0.0.0/src/math/w64.bend: https://jend.leeeet.dev/read.txt?path=bend-collections@1.0.0.0/src/math/w64.bend&start_line=320&end_line=325 import Base # Knuth's estimate for x = xh * 2^64 + xl < b * 2^32 and b >= 2^32, t = # bits(hi(b)): with Y = x >> t (below 2^64) and B = b >> t in [2^31, 2^32), # min(floor(Y / B), 2^32 - 1) is at least floor(x / b) (as B 2^t <= b) and at # most 2 over it (Theorem B), so q_start takes a step or two def est_lo(+q1: Nat, +t2: Nat, +d: Nat) -> U32: U32.from_nat(Nat.add(Nat.mul(q1, 65536n), Nat.div(t2, d))) Uses (6): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.add https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.div https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.mul https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.from_nat