summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Doc/ref/ref5.tex18
1 files changed, 14 insertions, 4 deletions
diff --git a/Doc/ref/ref5.tex b/Doc/ref/ref5.tex
index f554ab4..af1fa19 100644
--- a/Doc/ref/ref5.tex
+++ b/Doc/ref/ref5.tex
@@ -599,10 +599,20 @@ The power operator has the same semantics as the built-in
\function{pow()} function, when called with two arguments: it yields
its left argument raised to the power of its right argument. The
numeric arguments are first converted to a common type. The result
-type is that of the arguments after coercion; if the result is not
-expressible in that type (as in raising an integer to a negative
-power, or a negative floating point number to a broken power), a
-\exception{TypeError} exception is raised.
+type is that of the arguments after coercion.
+
+With mixed operand types, the coercion rules for binary arithmetic
+operators apply. For int and long int operands, the result has the
+same type as the operands (after coercion) unless the second argument
+is negative; in that case, all arguments are converted to float and a
+float result is delivered. For example, \code{10**2} returns \code{100},
+but \code{10**-2} returns \code{0.01}. (This last feature was added in
+Python 2.2. In Python 2.1 and before, if both arguments were of integer
+types and the second argument was negative, an exception was raised).
+
+Raising \code{0.0} to a negative power results in a
+\exception{ZeroDivisionError}. Raising a negative number to a
+fractional power results in a \exception{ValueError}.
\section{Unary arithmetic operations \label{unary}}