]> granicus.if.org Git - python/commitdiff
Correct documentation for math.pow;
authorMark Dickinson <dickinsm@gmail.com>
Sat, 19 Apr 2008 21:35:35 +0000 (21:35 +0000)
committerMark Dickinson <dickinsm@gmail.com>
Sat, 19 Apr 2008 21:35:35 +0000 (21:35 +0000)
0**nan is nan, not 0.  (But nan**0 and 1**nan are 1.)

Also fix minor typo: 'quite NaN' -> 'quiet NaN'

Doc/library/math.rst

index ad36f9234d5f546d74d96893511b7ed3d735ef72..2c1677cbdb608bbe3aa1d858fb66e0423bd131e8 100644 (file)
@@ -154,11 +154,15 @@ Power and logarithmic functions:
 
 .. function:: pow(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*.
+   Return ``x`` raised to the power ``y``.  Exceptional cases follow
+   Annex 'F' of the C99 standard as far as possible.  In particular,
+   ``pow(1.0, x)`` and ``pow(x, 0.0)`` always return ``1.0``, even
+   when ``x`` is a zero or a NaN.  If both ``x`` and ``y`` are finite,
+   ``x`` is negative, and ``y`` is not an integer then ``pow(x, y)``
+   is undefined, and raises :exc:`ValueError`.
 
    .. versionchanged:: 2.6
-      The outcome of ``1**nan`` and ``0**nan`` was undefined.
+      The outcome of ``1**nan`` and ``nan**0`` was undefined.
 
 
 .. function:: sqrt(x)
@@ -290,7 +294,7 @@ 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*.
+   All functions return a quiet *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*.