added assertion that n >= 0
This commit is contained in:
parent
1c42a9daca
commit
d2eca73482
|
@ -1097,6 +1097,7 @@ def integer_squareroot(n: int) -> int:
|
|||
"""
|
||||
The largest integer ``x`` such that ``x**2`` is less than ``n``.
|
||||
"""
|
||||
assert n >= 0
|
||||
x = n
|
||||
y = (x + 1) // 2
|
||||
while y < x:
|
||||
|
|
Loading…
Reference in New Issue