This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author tim.peters
Recipients mark.dickinson, martin.panter, ned.deily, rhettinger, serhiy.storchaka, steven.daprano, tim.peters, vstinner
Date 2016-09-16.19:12:25
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1474053145.46.0.21204096214.issue27761@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2016-09-16 19:12:25tim.peterssetrecipients: + tim.peters, rhettinger, mark.dickinson, vstinner, ned.deily, steven.daprano, martin.panter, serhiy.storchaka
2016-09-16 19:12:25tim.peterssetmessageid: <1474053145.46.0.21204096214.issue27761@psf.upfronthosting.co.za>
2016-09-16 19:12:25tim.peterslinkissue27761 messages
2016-09-16 19:12:25tim.peterscreate