[issue43053] Speed up math.isqrt, again

Mark Dickinson report at bugs.python.org
Thu Jan 28 08:57:22 EST 2021


Mark Dickinson <dickinsm at gmail.com> added the comment:

> the only thing I'm not sure about is whether the final correction in the original `isqrt` is needed

Well, *some* part of the algorithm has to make use of the low-order bits of n. Otherwise we won't be able to distinguish n = 4a**2 + 4a + 1 (whose isqrt is 2a + 1) from 4a**2 + 4a (whose isqrt is 2a).

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43053>
_______________________________________


More information about the Python-bugs-list mailing list