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

Mark Dickinson report at bugs.python.org
Sun Apr 9 12:12:54 EDT 2017


Mark Dickinson added the comment:

> Is math.exp(x) always more accurate than math.e ** x?

As Serhiy says: not always, and in general the answer is going to depend on the relative quality of the libm implementations of pow and exp. But on typical machines, it is going to be true that `math.exp(x)` is a better (faster, more accurate) way of computing the exponential function than `math.e ** x`. (Similarly, `math.sqrt(x)` should be preferred over `x ** 0.5`.) I'm not sure whether it's worth encoding such recommendations in the documentation or not.

----------

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


More information about the docs mailing list