Serhiy Storchaka added the comment: What if use pow() with exactly represented degree in approximating step?
def rootn(x, n): g = x**(1.0/n) m = 1 << (n-1).bit_length() if n != m: g = (x*g**(m-n))**(1.0/m) return g Maybe it needs several iterations, because it converges slower than Newton approximation. But every step can be faster. ---------- nosy: +serhiy.storchaka _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue27761> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com