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 rhettinger
Recipients belopolsky, docs@python, mark.dickinson, rhettinger, serhiy.storchaka, stutzbach, terry.reedy, tim.peters
Date 2017-04-09.18:55:02
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1491764102.55.0.385064251509.issue29956@psf.upfronthosting.co.za>
In-reply-to
Content
> Is math.exp(x) always more accurate than math.e ** x? 

It is usually at least as accurate, but we can't really guarantee anything because math.exp does whatever the underlying C math library does (so good libary -> good result, bad library -> bad result).

Rather than gum-up the math library docs, I suggest having a FAQ entry or wiki entry somewhere.  Getting extreme accuracy is a nebulous topic in general and even more so in Python (where there is very little you can do to prevent double rounding and whatnot).  

In addition to extreme accuracy issues, there are also performance issues which will vary from implementation to implementation and from release to release.

Historically, the docs have tried to rise above the fray and make very few if any promises about accuracy or speed.  This should be doubly true when it comes to numerical methods which are a mix of art, science, and dark art (and where the answers to "what is best" may change depending on the range of input values).
History
Date User Action Args
2017-04-09 18:55:02rhettingersetrecipients: + rhettinger, tim.peters, terry.reedy, mark.dickinson, belopolsky, stutzbach, docs@python, serhiy.storchaka
2017-04-09 18:55:02rhettingersetmessageid: <1491764102.55.0.385064251509.issue29956@psf.upfronthosting.co.za>
2017-04-09 18:55:02rhettingerlinkissue29956 messages
2017-04-09 18:55:02rhettingercreate