Skip to content

Conversation

mdickinson
Copy link
Member

As pointed out in issue 29956, math.exp(x) is not the same as math.e**x. This PR attempts to make the documentation a bit less misleading.

@mention-bot
Copy link

@mdickinson, thanks for your PR! By analyzing the history of the files in this pull request, we identified @birkenfeld, @tiran and @benjaminp to be potential reviewers.

@@ -199,8 +199,8 @@ Power and logarithmic functions

.. function:: exp(x)

Return ``e**x``.

Return e raised to the power *x*, where e = 2.718281... is the base
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think e should be emphasized, like in log(), log1p, etc. Maybe e = 2.718281... should have the code markup.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's not clear. The problem with marking it up is that we get back to the issue where it could be confused with math.e. I decided not to mark it up, to be consistent with the documentation for math.e.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think math.expm1 needs to be changed too?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@csabella: Yes! How about

Return e raised to the power x, minus one. For small floats x, the [...]

?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

e = 2.718281... is not a code. I don't think it should have the code markup.

Emphasized *e* is used in descriptions of log() and log1p(). But it also is used in frexp(). I suggest to rename e in frexp() description for avoiding confusion.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be best to use Sphinx's inline math construct here. Is there anything that would prevent using :math: role in Python documentation?

@rhettinger rhettinger merged commit 7341259 into python:master Apr 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants