[issue27761] Private _nth_root function loses accuracy

Mark Dickinson report at bugs.python.org
Wed Aug 17 08:31:18 EDT 2016


Mark Dickinson added the comment:

Victor: by "way too slow", I really *do* mean way too slow. :-)

floor_nroot does arithmetic with integers of bit-length approximately 54*n. For small n, that's fine, but if someone tried to take the geometric mean of a list of 50000 values (which it seems to me should be a perfectly reasonable use-case), floor_nroot would then be trying to do computations with multi-million-bit integers. The `a**(n-1)` operation in particular would be a killer for large `n`.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27761>
_______________________________________


More information about the Python-bugs-list mailing list