Serhiy Storchaka added the comment:
Wouldn't following implementation be faster?
import decimal
c = decimal.DefaultContext.copy()
c.prec = 25
def rootn(x, n,
D=decimal.Decimal,
sub=c.subtract,
mul=c.multiply,
log=c.ln):
g = x ** (1.0/n)
g += float(sub(log(D(x)), mul(log(D(g)), D(n)))) * g / n
return g
del decimal, c
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue27761>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com