Tim Peters added the comment:

That's clever, Serhiy!  Where did it come from?  It's not Newton's method, but 
it also appears to enjoy quadratic convergence.

As to speed, why are you asking?  You should be able to time it, yes?  On my 
box, it's about 6 times slower than the last code I posted.  I assume (but 
don't know) that's because + - * / have trivial cost compared to power() and 
ln(), and your code uses two ln() while the last code I posted uses only one 
power().  Also, my power() has an exact integer exponent, which - for whatever 
reasons - appears to run much faster than using a non-integer Decimal exponent. 
 It's for the latter reason that I didn't suggest just doing `return float(D(x) 
** (D(1)/n))` (much slower).

Or maybe it's "a platform thing".  FYI, I'm using the released Python 3.5.2 on 
64-bit Win 10 Pro.

----------

_______________________________________
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

Reply via email to