diff options
author | Mark Dickinson <dickinsm@gmail.com> | 2009-12-16 20:23:42 (GMT) |
---|---|---|
committer | Mark Dickinson <dickinsm@gmail.com> | 2009-12-16 20:23:42 (GMT) |
commit | 664b511c0acdfdecdec92d2255ffd94c4e6d5f7a (patch) | |
tree | 075cdf8651d66f24e42c1b87e57e7423e3e7a9d3 /Doc/library | |
parent | ef1992b9fbcfb1dae7e946bfc42403fcaae9f044 (diff) | |
download | cpython-664b511c0acdfdecdec92d2255ffd94c4e6d5f7a.zip cpython-664b511c0acdfdecdec92d2255ffd94c4e6d5f7a.tar.gz cpython-664b511c0acdfdecdec92d2255ffd94c4e6d5f7a.tar.bz2 |
Merged revisions 76861 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r76861 | mark.dickinson | 2009-12-16 20:13:40 +0000 (Wed, 16 Dec 2009) | 3 lines
Issue #3366: Add expm1 function to math module. Thanks Eric Smith for
testing on Windows.
........
Diffstat (limited to 'Doc/library')
-rw-r--r-- | Doc/library/math.rst | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Doc/library/math.rst b/Doc/library/math.rst index e903c5f..39aea29 100644 --- a/Doc/library/math.rst +++ b/Doc/library/math.rst @@ -148,6 +148,20 @@ Power and logarithmic functions Return ``e**x``. +.. function:: expm1(x) + + Return ``e**x - 1``. For small floats *x*, the subtraction in + ``exp(x) - 1`` can result in a significant loss of precision; the + :func:`expm1` function provides a way to compute this quantity to + full precision:: + + >>> from math import exp, expm1 + >>> exp(1e-5) - 1 # gives result accurate to 11 places + 1.0000050000069649e-05 + >>> expm1(1e-5) # result accurate to full precision + 1.0000050000166668e-05 + + .. function:: log(x[, base]) With one argument, return the natural logarithm of *x* (to base *e*). |