summaryrefslogtreecommitdiffstats
path: root/Doc/library/math.rst
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2017-05-04 09:25:09 (GMT)
committerGitHub <noreply@github.com>2017-05-04 09:25:09 (GMT)
commitdbaf746b6de0ee431c809d3175ab40ccc18898a8 (patch)
treea7a07d3e2bde0a326e2c5fba7c2fce4396bdb1cd /Doc/library/math.rst
parent7e4db2f253c555568d56177c2fd083bcf8f88d34 (diff)
downloadcpython-dbaf746b6de0ee431c809d3175ab40ccc18898a8.zip
cpython-dbaf746b6de0ee431c809d3175ab40ccc18898a8.tar.gz
cpython-dbaf746b6de0ee431c809d3175ab40ccc18898a8.tar.bz2
bpo-29956: Improve the math.exp() related documentation. (#1073)
Diffstat (limited to 'Doc/library/math.rst')
-rw-r--r--Doc/library/math.rst27
1 files changed, 18 insertions, 9 deletions
diff --git a/Doc/library/math.rst b/Doc/library/math.rst
index 0c53b29..9e49463 100644
--- a/Doc/library/math.rst
+++ b/Doc/library/math.rst
@@ -42,15 +42,18 @@ Number-theoretic and representation functions
*y*. On platforms that support signed zeros, ``copysign(1.0, -0.0)``
returns *-1.0*.
+
.. function:: fabs(x)
Return the absolute value of *x*.
+
.. function:: factorial(x)
Return *x* factorial. Raises :exc:`ValueError` if *x* is not integral or
is negative.
+
.. function:: floor(x)
Return the floor of *x*, the largest integer less than or equal to *x*.
@@ -220,12 +223,15 @@ Power and logarithmic functions
.. function:: exp(x)
- Return e raised to the power *x*, where e = 2.718281... is the base
- of natural logarithms.
+ Return *e* raised to the power *x*, where *e* = 2.718281... is the base
+ of natural logarithms. This is usually more accurate than ``math.e ** x``
+ or ``pow(math.e, x)``.
+
.. function:: expm1(x)
- Return ``e**x - 1``. For small floats *x*, the subtraction in ``exp(x) - 1``
+ Return *e* raised to the power *x*, minus 1. Here *e* is the base of natural
+ logarithms. For small floats *x*, the subtraction in ``exp(x) - 1``
can result in a `significant loss of precision
<https://en.wikipedia.org/wiki/Loss_of_significance>`_\; the :func:`expm1`
function provides a way to compute this quantity to full precision::
@@ -290,10 +296,10 @@ Power and logarithmic functions
Return the square root of *x*.
+
Trigonometric functions
-----------------------
-
.. function:: acos(x)
Return the arc cosine of *x*, in radians.
@@ -339,10 +345,10 @@ Trigonometric functions
Return the tangent of *x* radians.
+
Angular conversion
------------------
-
.. function:: degrees(x)
Convert angle *x* from radians to degrees.
@@ -352,6 +358,7 @@ Angular conversion
Convert angle *x* from degrees to radians.
+
Hyperbolic functions
--------------------
@@ -440,23 +447,25 @@ Constants
.. data:: pi
- The mathematical constant π = 3.141592..., to available precision.
+ The mathematical constant *π* = 3.141592..., to available precision.
.. data:: e
- The mathematical constant e = 2.718281..., to available precision.
+ The mathematical constant *e* = 2.718281..., to available precision.
+
.. data:: tau
- The mathematical constant τ = 6.283185..., to available precision.
- Tau is a circle constant equal to 2π, the ratio of a circle's circumference to
+ The mathematical constant *τ* = 6.283185..., to available precision.
+ Tau is a circle constant equal to 2\ *π*, the ratio of a circle's circumference to
its radius. To learn more about Tau, check out Vi Hart's video `Pi is (still)
Wrong <https://www.youtube.com/watch?v=jG7vhMMXagQ>`_, and start celebrating
`Tau day <http://tauday.com/>`_ by eating twice as much pie!
.. versionadded:: 3.6
+
.. data:: inf
A floating-point positive infinity. (For negative infinity, use