From bb2460e58284f8ce2d63357305058a30e784bc33 Mon Sep 17 00:00:00 2001 From: Mark Dickinson Date: Fri, 20 Aug 2021 11:18:45 +0100 Subject: [PATCH] bpo-44344: Document that pow can return a complex number for non-complex inputs. --- Doc/library/functions.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst index 652e30c6088ad9..5226b259b719cd 100644 --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -1357,7 +1357,10 @@ are always available. They are listed here in alphabetical order. 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, ``10**2`` - returns ``100``, but ``10**-2`` returns ``0.01``. + returns ``100``, but ``10**-2`` returns ``0.01``. For a negative base of + type :class:`int` or :class:`float` and a non-integral exponent, a complex + result is delivered. For example, ``(-9)**0.5`` returns a value close + to ``3j``. For :class:`int` operands *base* and *exp*, if *mod* is present, *mod* must also be of integer type and *mod* must be nonzero. If *mod* is present and