def isqrt_big

bend-collections@1.0.0.0 · src/math/w64.bend:497

import bend-collections@1.0.0.0/src/math/w64.bend as W64
import Base
import bend-collections@1.0.0.0/src/math/u64.bend as W

497# one Newton step from the F32 estimate r0 > 0 lands within a few units of
498# floor(sqrt(n)); the correction makes the result exact for any r0
499def isqrt_big(+n: W.U64, +r0: U32) -> W.U64:
500  W.U64{isqrt_newton(n, q_clamp(half(add(fst_q(div32(n, r0)), W.U64{r0, 0})))), 0}

Uses (8)

Used by (1)