def down32
import bend-collections-laws-math@1.0.0.0/src/math/w64.bend as W64import Base
428# r - 1 while r * r > x: from r <= 65535 at most r steps (fuel r + 1), and
429# r * r never wraps
430def down32(fuel: Nat, +x: U32, +r: U32, over: Bool) -> U32:
431 match fuel over:
432 case 0n _:
433 r
434 case 1n+f False{}:
435 r
436 case 1n+f True{}:
437 down32(f, x, U32.sub(r, 1), U32.is_lt(x, U32.mul(U32.sub(r, 1), U32.sub(r, 1))))
Uses (6)
Used by (5)
- bend-collections-laws-math@1.0.0.0/proofs/math/typed/w64sqrt:isqrt32_value
- bend-collections-laws-math@1.0.0.0/proofs/math/typed/w64sqrt:dn
- bend-collections-laws-math@1.0.0.0/proofs/math/typed/w64sqrt:main_est
- bend-collections-laws-math@1.0.0.0/proofs/math/typed/w64sqrt:main_sqrt
- bend-collections-laws-math@1.0.0.0/src/math/w64:isqrt32_est