bpo-44344: Document that pow can return a complex number for non-complex inputs. (GH-27853)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
This commit is contained in:
Mark Dickinson 2021-10-21 21:57:49 +01:00 committed by GitHub
parent 087f089e5e
commit 887a55705b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -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