summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2021-10-21 15:08:36 -0700
committerGitHub <noreply@github.com>2021-10-22 00:08:36 +0200
commitc53428fe8980aab6eda3e573bafed657e6798e6e (patch)
tree27a9d3325dd957a5bcbef4a463bddcccba34804b
parentb26eae54e98f44eebc1599ca458228dae0568ffa (diff)
downloadcpython-git-c53428fe8980aab6eda3e573bafed657e6798e6e.tar.gz
bpo-44344: Document that pow can return a complex number for non-complex inputs. (GH-27853) (GH-29134)
Co-authored-by: Ɓukasz Langa <lukasz@langa.pl> (cherry picked from commit 887a55705bb6c05a507c2886c9978a9e0cff0dd7) Co-authored-by: Mark Dickinson <mdickinson@enthought.com>
-rw-r--r--Doc/library/functions.rst5
1 files changed, 4 insertions, 1 deletions
diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst
index b17ca69760..942ad6fab8 100644
--- a/Doc/library/functions.rst
+++ b/Doc/library/functions.rst
@@ -1299,7 +1299,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, ``pow(10, 2)``
- returns ``100``, but ``pow(10, -2)`` returns ``0.01``.
+ returns ``100``, but ``pow(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, ``pow(-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