@@ -1292,11 +1292,42 @@ Here are all of the changes that Python 2.6 makes to the core Python language.
12921292 :func: `isnan `, return true if their floating-point argument is
12931293 infinite or Not A Number. (:issue: `1640 `)
12941294
1295- The ``math.copysign(x, y) `` function
1296- copies the sign bit of an IEEE 754 number, returning the absolute
1297- value of *x * combined with the sign bit of *y *. For example,
1298- ``math.copysign(1, -0.0) `` returns -1.0. (Contributed by Christian
1299- Heimes.)
1295+ * The :mod: `math ` module has seven new functions, and the existing
1296+ functions have been improved to give more consistent behaviour
1297+ across platforms, especially with respect to handling of
1298+ floating-point exceptions and IEEE 754 special values.
1299+ The new functions are:
1300+
1301+ * :func: `isinf ` and :func: `isnan ` determine whether a given float is
1302+ a (positive or negative) infinity or a NaN (Not a Number),
1303+ respectively.
1304+
1305+ * ``copysign(x, y) `` copies the sign bit of an IEEE 754 number,
1306+ returning the absolute value of *x * combined with the sign bit of
1307+ *y *. For example, ``math.copysign(1, -0.0) `` returns -1.0.
1308+ (Contributed by Christian Heimes.)
1309+
1310+ * The inverse hyperbolic functions :func: `acosh `, :func: `asinh ` and
1311+ :func: `atanh `.
1312+
1313+ * The function :func: `log1p `, returning the natural logarithm of
1314+ *1+x * (base *e *).
1315+
1316+ There's also a new :func: `trunc ` function as a result of the
1317+ backport of `PEP 3141's type hierarchy for numbers <#pep-3141 >`__.
1318+
1319+ The existing math functions have been modified to follow the
1320+ recommendations of the C99 standard with respect to special values
1321+ whenever possible. For example, ``sqrt(-1.) `` should now give a
1322+ :exc: `ValueError ` across (nearly) all platforms, while
1323+ ``sqrt(float('NaN')) `` should return a NaN on all IEEE 754
1324+ platforms. Where Annex 'F' of the C99 standard recommends signaling
1325+ 'divide-by-zero' or 'invalid', Python will raise :exc: `ValueError `.
1326+ Where Annex 'F' of the C99 standard recommends signaling 'overflow',
1327+ Python will raise :exc: `OverflowError `. (See :issue: `711019 `,
1328+ :issue: `1640 `.)
1329+
1330+ (Contributed by Christian Heimes and Mark Dickinson.)
13001331
13011332* Changes to the :class: `Exception ` interface
13021333 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.
14151446 available, instead of restricting itself to protocol 1.
14161447 (Contributed by W. Barnes; :issue: `1551443 `.)
14171448
1449+ * The :mod: `cmath ` module underwent an extensive set of revisions,
1450+ thanks to Mark Dickinson and Christian Heimes, that added some new
1451+ features and greatly improved the accuracy of the computations.
1452+
1453+ Five new functions were added:
1454+
1455+ * :func: `polar ` converts a complex number to polar form, returning
1456+ the modulus and argument of that complex number.
1457+
1458+ * :func: `rect ` does the opposite, turning a (modulus, argument) pair
1459+ back into the corresponding complex number.
1460+
1461+ * :func: `phase ` returns the phase or argument of a complex number.
1462+
1463+ * :func: `isnan ` returns True if either
1464+ the real or imaginary part of its argument is a NaN.
1465+
1466+ * :func: `isinf ` returns True if either the real or imaginary part of
1467+ its argument is infinite.
1468+
1469+ The revisions also improved the numerical soundness of the
1470+ :mod: `cmath ` module. For all functions, the real and imaginary
1471+ parts of the results are accurate to within a few units of least
1472+ precision (ulps) whenever possible. See :issue: `1381 ` for the
1473+ details. The branch cuts for :func: `asinh `, :func: `atanh `: and
1474+ :func: `atan ` have also been corrected.
1475+
1476+ The tests for the module have been greatly expanded; nearly 2000 new
1477+ test cases exercise the algebraic functions.
1478+
1479+ On IEEE 754 platforms, the :mod: `cmath ` module now handles IEEE 754
1480+ special values and floating-point exceptions in a manner consistent
1481+ with Annex 'G' of the C99 standard.
1482+
14181483* A new data type in the :mod: `collections ` module: :class: `namedtuple(typename,
14191484 fieldnames) ` is a factory function that creates subclasses of the standard tuple
14201485 whose fields are accessible by name as well as index. For example::
0 commit comments