[docs] [issue29956] math.exp documentation is misleading

Raymond Hettinger report at bugs.python.org
Sun Apr 9 14:55:02 EDT 2017


Raymond Hettinger added the comment:

> 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).

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29956>
_______________________________________


More information about the docs mailing list