Message273829
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 |
|
Date |
User |
Action |
Args |
2016-08-28 16:27:53 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, tim.peters, rhettinger, mark.dickinson, vstinner, ned.deily, steven.daprano, martin.panter |
2016-08-28 16:27:53 | serhiy.storchaka | set | messageid: <1472401673.1.0.416658723796.issue27761@psf.upfronthosting.co.za> |
2016-08-28 16:27:53 | serhiy.storchaka | link | issue27761 messages |
2016-08-28 16:27:53 | serhiy.storchaka | create | |
|