diff options
author | Christian Heimes <christian@cheimes.de> | 2008-04-19 00:31:39 (GMT) |
---|---|---|
committer | Christian Heimes <christian@cheimes.de> | 2008-04-19 00:31:39 (GMT) |
commit | 53876d9cd8a67d9e67772e082deab92a598f74b3 (patch) | |
tree | 2d605900cab56cbfe55c6ca6e41f1a0c0cb6f91b /Doc/library/math.rst | |
parent | dc3e06ce3a24882a6b68ec19544910095770111e (diff) | |
download | cpython-53876d9cd8a67d9e67772e082deab92a598f74b3.zip cpython-53876d9cd8a67d9e67772e082deab92a598f74b3.tar.gz cpython-53876d9cd8a67d9e67772e082deab92a598f74b3.tar.bz2 |
Merged revisions 62380,62382-62383 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r62380 | christian.heimes | 2008-04-19 01:13:07 +0200 (Sat, 19 Apr 2008) | 3 lines
I finally got the time to update and merge Mark's and my trunk-math branch. The patch is collaborated work of Mark Dickinson and me. It was mostly done a few months ago. The patch fixes a lot of loose ends and edge cases related to operations with NaN, INF, very small values and complex math.
The patch also adds acosh, asinh, atanh, log1p and copysign to all platforms. Finally it fixes differences between platforms like different results or exceptions for edge cases. Have fun :)
........
r62382 | christian.heimes | 2008-04-19 01:40:40 +0200 (Sat, 19 Apr 2008) | 2 lines
Added new files to Windows project files
More Windows related fixes are coming soon
........
r62383 | christian.heimes | 2008-04-19 01:49:11 +0200 (Sat, 19 Apr 2008) | 1 line
Stupid me. Py_RETURN_NAN should actually return something ...
........
Diffstat (limited to 'Doc/library/math.rst')
-rw-r--r-- | Doc/library/math.rst | 47 |
1 files changed, 45 insertions, 2 deletions
diff --git a/Doc/library/math.rst b/Doc/library/math.rst index f69c0a0..024897f 100644 --- a/Doc/library/math.rst +++ b/Doc/library/math.rst @@ -128,6 +128,14 @@ Power and logarithmic functions: return the natural logarithm of *x* (that is, the logarithm to base *e*). +.. function:: log1p(x) + + Return the natural logarithm of *1+x* (base *e*). The + result is calculated in a way which is accurate for *x* near zero. + + .. versionadded:: 2.6 + + .. function:: log10(x) Return the base-10 logarithm of *x*. @@ -135,7 +143,11 @@ Power and logarithmic functions: .. function:: pow(x, y) - Return ``x**y``. + Return ``x**y``. ``1.0**y`` returns *1.0*, even for ``1.0**nan``. ``0**y`` + returns *0.* for all positive *y*, *0* and *NAN*. + + .. versionchanged:: 2.6 + The outcome of ``1**nan`` and ``0**nan`` was undefined. .. function:: sqrt(x) @@ -186,6 +198,13 @@ Trigonometric functions: Return the sine of *x* radians. +.. function:: asinh(x) + + Return the inverse hyperbolic sine of *x*, in radians. + + .. versionadded:: 2.6 + + .. function:: tan(x) Return the tangent of *x* radians. @@ -210,6 +229,13 @@ Hyperbolic functions: Return the hyperbolic cosine of *x*. +.. function:: acosh(x) + + Return the inverse hyperbolic cosine of *x*, in radians. + + .. versionadded:: 2.6 + + .. function:: sinh(x) Return the hyperbolic sine of *x*. @@ -219,6 +245,14 @@ Hyperbolic functions: Return the hyperbolic tangent of *x*. + +.. function:: atanh(x) + + Return the inverse hyperbolic tangent of *x*, in radians. + + .. versionadded:: 2.6 + + The module also defines two mathematical constants: @@ -231,6 +265,7 @@ The module also defines two mathematical constants: The mathematical constant *e*. + .. note:: The :mod:`math` module consists mostly of thin wrappers around the platform C @@ -244,9 +279,17 @@ The module also defines two mathematical constants: :exc:`OverflowError` isn't defined, and in cases where ``math.log(0)`` raises :exc:`OverflowError`, ``math.log(0L)`` may raise :exc:`ValueError` instead. + All functions return a quite *NaN* if at least one of the args is *NaN*. + Signaling *NaN*s raise an exception. The exception type still depends on the + platform and libm implementation. It's usually :exc:`ValueError` for *EDOM* + and :exc:`OverflowError` for errno *ERANGE*. + + ..versionchanged:: 2.6 + In earlier versions of Python the outcome of an operation with NaN as + input depended on platform and libm implementation. + .. seealso:: Module :mod:`cmath` Complex number versions of many of these functions. - |