Commit 2dfeaa92 authored by Mark Dickinson's avatar Mark Dickinson Committed by GitHub

Turn math.isqrt assertion into a comment to clarify its purpose. (GH-14131)

parent 45e0411e
......@@ -1527,10 +1527,10 @@ Here's Python code equivalent to the C implementation below:
a = 1
d = 0
for s in reversed(range(c.bit_length())):
# Loop invariant: (a-1)**2 < (n >> 2*(c - d)) < (a+1)**2
e = d
d = c >> s
a = (a << d - e - 1) + (n >> 2*c - e - d + 1) // a
assert (a-1)**2 < n >> 2*(c - d) < (a+1)**2
return a - (a*a > n)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment