Skip to main content

isqrt

Function isqrt 

Source
pub fn isqrt(n: &BigInt) -> BigInt
Expand description

The integer square root ⌊√n⌋ (Newton’s method). The floating-point seed is only ~15 digits precise, so it is first forced to an OVERESTIMATE (x² ≥ n, a handful of doublings); from above, the Newton iteration x ← ⌊(x + ⌊n/x⌋)/2⌋ decreases monotonically and halts exactly at ⌊√n⌋.