File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -305,12 +305,14 @@ def _fail_neg(values, errmsg='negative value'):
305305 yield x
306306
307307def _isqrt_frac_rto (n : int , m : int ) -> float :
308- 'Square root of n/m, rounded to the nearest integer using round-to-odd.'
308+ """Square root of n/m, rounded to the nearest integer using round-to-odd."""
309+ # Refernce: https://www.lri.fr/~melquion/doc/05-imacs17_1-expose.pdf
309310 a = math .isqrt (n // m )
310311 return a | (a * a * m != n )
311312
312313def _sqrt_frac (n : int , m : int ) -> float :
313- 'Square root of n/m as a float, correctly rounded.'
314+ """Square root of n/m as a float, correctly rounded."""
315+ # See algorithm sketch at: https://bugs.python.org/msg406911
314316 # The constant 109 is: 3 + 2 * sys.float_info.mant_dig
315317 q : int = (n .bit_length () - m .bit_length () - 109 ) // 2
316318 if q >= 0 :
You can’t perform that action at this time.
0 commit comments