summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorMark Dickinson <mdickinson@enthought.com>2021-10-21 20:57:49 (GMT)
committerGitHub <noreply@github.com>2021-10-21 20:57:49 (GMT)
commit887a55705bb6c05a507c2886c9978a9e0cff0dd7 (patch)
treecf50203375c418902ed003a27737195a3b6bbe9d /Doc
parent087f089e5e04d5b132ffbff0576667d591f13219 (diff)
downloadcpython-887a55705bb6c05a507c2886c9978a9e0cff0dd7.zip
cpython-887a55705bb6c05a507c2886c9978a9e0cff0dd7.tar.gz
cpython-887a55705bb6c05a507c2886c9978a9e0cff0dd7.tar.bz2
bpo-44344: Document that pow can return a complex number for non-complex inputs. (GH-27853)
Co-authored-by: Ɓukasz Langa <lukasz@langa.pl>
Diffstat (limited to 'Doc')
-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 a651d88..0921168 100644
--- a/Doc/library/functions.rst
+++ b/Doc/library/functions.rst
@@ -1346,7 +1346,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