diff options
author | Christian Heimes <christian@cheimes.de> | 2008-04-20 21:01:16 (GMT) |
---|---|---|
committer | Christian Heimes <christian@cheimes.de> | 2008-04-20 21:01:16 (GMT) |
commit | a342c013fc97df2110c420af2cd66b7e8489b9af (patch) | |
tree | 8e95e3309129066e84c3aa83bdbc7aaf087fbf62 /Doc/whatsnew/2.6.rst | |
parent | 58f9e4f34793a14050648c9f620e96189908a3e9 (diff) | |
download | cpython-a342c013fc97df2110c420af2cd66b7e8489b9af.zip cpython-a342c013fc97df2110c420af2cd66b7e8489b9af.tar.gz cpython-a342c013fc97df2110c420af2cd66b7e8489b9af.tar.bz2 |
Merged revisions 62386-62387,62389-62393,62396,62400-62402,62407,62409-62410,62412-62414,62418-62419 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r62386 | christian.heimes | 2008-04-19 04:23:57 +0200 (Sat, 19 Apr 2008) | 2 lines
Added kill, terminate and send_signal to subprocess.Popen
The bits and pieces for the Windows side were already in place. The POSIX side is trivial (as usual) and uses os.kill().
........
r62387 | georg.brandl | 2008-04-19 10:23:59 +0200 (Sat, 19 Apr 2008) | 2 lines
Fix-up docs for revision 62386.
........
r62389 | georg.brandl | 2008-04-19 18:57:43 +0200 (Sat, 19 Apr 2008) | 2 lines
#2369: clarify that copyfile() doesn't take a target directory.
........
r62390 | georg.brandl | 2008-04-19 18:58:28 +0200 (Sat, 19 Apr 2008) | 2 lines
#2634: clarify meaning of env parameter to spawn/exec*e.
........
r62391 | georg.brandl | 2008-04-19 18:58:49 +0200 (Sat, 19 Apr 2008) | 2 lines
#2633: clarify meaning of env parameter.
........
r62392 | georg.brandl | 2008-04-19 18:59:16 +0200 (Sat, 19 Apr 2008) | 2 lines
#2631: clarify IMPORT_NAME semantics.
........
r62393 | georg.brandl | 2008-04-19 19:00:14 +0200 (Sat, 19 Apr 2008) | 2 lines
:func: et al. should *not* include the parens.
........
r62396 | mark.dickinson | 2008-04-19 20:51:48 +0200 (Sat, 19 Apr 2008) | 5 lines
Additional tests for math.pow, and extra special-case
handling code in math.pow, in the hope of making all
tests pass on the alpha Tru64 buildbot.
........
r62400 | mark.dickinson | 2008-04-19 21:41:52 +0200 (Sat, 19 Apr 2008) | 3 lines
Additional special-case handling for math.pow.
Windows/VS2008 doesn't like (-1)**(+-inf).
........
r62401 | benjamin.peterson | 2008-04-19 21:47:34 +0200 (Sat, 19 Apr 2008) | 2 lines
Complete documentation for errors argument of io's open and TextIOWrapper
........
r62402 | mark.dickinson | 2008-04-19 22:31:16 +0200 (Sat, 19 Apr 2008) | 2 lines
Document updates to math and cmath modules.
........
r62407 | georg.brandl | 2008-04-19 23:28:38 +0200 (Sat, 19 Apr 2008) | 2 lines
Update template for newest Sphinx.
........
r62409 | mark.dickinson | 2008-04-19 23:35:35 +0200 (Sat, 19 Apr 2008) | 5 lines
Correct documentation for math.pow;
0**nan is nan, not 0. (But nan**0 and 1**nan are 1.)
Also fix minor typo: 'quite NaN' -> 'quiet NaN'
........
r62410 | mark.dickinson | 2008-04-19 23:49:22 +0200 (Sat, 19 Apr 2008) | 4 lines
Move asinh documentation to the proper place.
Remove meaningless 'in radians' from inverse
hyperbolic functions.
........
r62412 | mark.dickinson | 2008-04-20 03:22:30 +0200 (Sun, 20 Apr 2008) | 5 lines
Report additional diagnostic information in
test_math, to help track down debian-alpha
buildbot failure.
........
r62413 | mark.dickinson | 2008-04-20 03:39:24 +0200 (Sun, 20 Apr 2008) | 3 lines
FreeBSD doesn't follow C99 for modf(inf); so add explicit
special-value handling to math.modf code.
........
r62414 | mark.dickinson | 2008-04-20 06:13:13 +0200 (Sun, 20 Apr 2008) | 5 lines
Yet more explicit special case handling to make
math.pow behave on alpha Tru64. All IEEE 754
special values are now handled directly; only
the finite**finite case is handled by libm.
........
r62418 | mark.dickinson | 2008-04-20 18:13:17 +0200 (Sun, 20 Apr 2008) | 7 lines
Issue 2662: Initialize special value tables dynamically (i.e. when
cmath module is loaded) instead of statically. This fixes compile-time
problems on platforms where HUGE_VAL is an extern variable rather than
a constant.
Thanks Hirokazu Yamamoto for the patch.
........
r62419 | andrew.kuchling | 2008-04-20 18:54:02 +0200 (Sun, 20 Apr 2008) | 1 line
Move description of math module changes; various edits to description of cmath changes
........
Diffstat (limited to 'Doc/whatsnew/2.6.rst')
-rw-r--r-- | Doc/whatsnew/2.6.rst | 75 |
1 files changed, 70 insertions, 5 deletions
diff --git a/Doc/whatsnew/2.6.rst b/Doc/whatsnew/2.6.rst index fa51221..eb5d4b2 100644 --- a/Doc/whatsnew/2.6.rst +++ b/Doc/whatsnew/2.6.rst @@ -1292,11 +1292,42 @@ Here are all of the changes that Python 2.6 makes to the core Python language. :func:`isnan`, return true if their floating-point argument is infinite or Not A Number. (:issue:`1640`) - The ``math.copysign(x, y)`` function - copies the sign bit of an IEEE 754 number, returning the absolute - value of *x* combined with the sign bit of *y*. For example, - ``math.copysign(1, -0.0)`` returns -1.0. (Contributed by Christian - Heimes.) +* The :mod:`math` module has seven new functions, and the existing + functions have been improved to give more consistent behaviour + across platforms, especially with respect to handling of + floating-point exceptions and IEEE 754 special values. + The new functions are: + + * :func:`isinf` and :func:`isnan` determine whether a given float is + a (positive or negative) infinity or a NaN (Not a Number), + respectively. + + * ``copysign(x, y)`` copies the sign bit of an IEEE 754 number, + returning the absolute value of *x* combined with the sign bit of + *y*. For example, ``math.copysign(1, -0.0)`` returns -1.0. + (Contributed by Christian Heimes.) + + * The inverse hyperbolic functions :func:`acosh`, :func:`asinh` and + :func:`atanh`. + + * The function :func:`log1p`, returning the natural logarithm of + *1+x* (base *e*). + + There's also a new :func:`trunc` function as a result of the + backport of `PEP 3141's type hierarchy for numbers <#pep-3141>`__. + + The existing math functions have been modified to follow the + recommendations of the C99 standard with respect to special values + whenever possible. For example, ``sqrt(-1.)`` should now give a + :exc:`ValueError` across (nearly) all platforms, while + ``sqrt(float('NaN'))`` should return a NaN on all IEEE 754 + platforms. Where Annex 'F' of the C99 standard recommends signaling + 'divide-by-zero' or 'invalid', Python will raise :exc:`ValueError`. + Where Annex 'F' of the C99 standard recommends signaling 'overflow', + Python will raise :exc:`OverflowError`. (See :issue:`711019`, + :issue:`1640`.) + + (Contributed by Christian Heimes and Mark Dickinson.) * Changes to the :class:`Exception` interface as dictated by :pep:`352` continue to be made. For 2.6, @@ -1415,6 +1446,40 @@ complete list of changes, or look through the CVS logs for all the details. available, instead of restricting itself to protocol 1. (Contributed by W. Barnes; :issue:`1551443`.) +* The :mod:`cmath` module underwent an extensive set of revisions, + thanks to Mark Dickinson and Christian Heimes, that added some new + features and greatly improved the accuracy of the computations. + + Five new functions were added: + + * :func:`polar` converts a complex number to polar form, returning + the modulus and argument of that complex number. + + * :func:`rect` does the opposite, turning a (modulus, argument) pair + back into the corresponding complex number. + + * :func:`phase` returns the phase or argument of a complex number. + + * :func:`isnan` returns True if either + the real or imaginary part of its argument is a NaN. + + * :func:`isinf` returns True if either the real or imaginary part of + its argument is infinite. + + The revisions also improved the numerical soundness of the + :mod:`cmath` module. For all functions, the real and imaginary + parts of the results are accurate to within a few units of least + precision (ulps) whenever possible. See :issue:`1381` for the + details. The branch cuts for :func:`asinh`, :func:`atanh`: and + :func:`atan` have also been corrected. + + The tests for the module have been greatly expanded; nearly 2000 new + test cases exercise the algebraic functions. + + On IEEE 754 platforms, the :mod:`cmath` module now handles IEEE 754 + special values and floating-point exceptions in a manner consistent + with Annex 'G' of the C99 standard. + * A new data type in the :mod:`collections` module: :class:`namedtuple(typename, fieldnames)` is a factory function that creates subclasses of the standard tuple whose fields are accessible by name as well as index. For example:: |