W64.isqrt_newton: def of bend-collections-laws-math@1.0.0.0 Import: import bend-collections-laws-math@1.0.0.0/src/math/w64.bend as W64 Lines 492-495 of bend-collections-laws-math@1.0.0.0/src/math/w64.bend: https://jend.leeeet.dev/read.txt?path=bend-collections-laws-math@1.0.0.0/src/math/w64.bend&start_line=492&end_line=495 import Base import bend-collections-laws-math@1.0.0.0/src/math/u64.bend as W # floor(sqrt(n)) from any estimate r1: down while r^2 > n, then up while # (r + 1)^2 <= n; the fuel covers any estimate def isqrt_newton(+n: W.U64, +r1: U32) -> U32: isqrt64_fix(n, down64(1n+U32.to_nat(r1), n, r1, sq_over(n, r1))) Uses (7): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.to_nat https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-math@1.0.0.0/src/math/u64.bend&name=U64 https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-math@1.0.0.0/src/math/w64.bend&name=down64 https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-math@1.0.0.0/src/math/w64.bend&name=isqrt64_fix https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-math@1.0.0.0/src/math/w64.bend&name=sq_over