Tim Peters added the comment:

Mark, the code I showed in roots.py is somewhat more accurate and highly 
significantly faster than the code you just posted.  It's not complicated at 
all:  it just uses Decimal to do a single Newton correction with extended 
precision.

Since it doesn't use the Decimal exp() or ln(), it's faster.  It does use the 
Decimal pow(), but with an integer exponent, so this specific use of pow() 
doesn't invoke the Decimal exp() or ln() either.  And it's still the case that 
I haven't found a case where its result isn't correctly rounded.  My testing 
framework found multiple not-correctly-rounded cases in your new code within 
seconds.

Presumably you could boost the precision to improve that, but then it would get 
even slower.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://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