Skip to content

Commit 9b3cda5

Browse files
bpo-44344: Document that pow can return a complex number for non-complex inputs. (GH-27853) (GH-29135)
Co-authored-by: Łukasz Langa <[email protected]> (cherry picked from commit 887a557) Co-authored-by: Mark Dickinson <[email protected]>
1 parent 8fd7e89 commit 9b3cda5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Doc/library/functions.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1357,7 +1357,10 @@ are always available. They are listed here in alphabetical order.
13571357
operands, the result has the same type as the operands (after coercion)
13581358
unless the second argument is negative; in that case, all arguments are
13591359
converted to float and a float result is delivered. For example, ``pow(10, 2)``
1360-
returns ``100``, but ``pow(10, -2)`` returns ``0.01``.
1360+
returns ``100``, but ``pow(10, -2)`` returns ``0.01``. For a negative base of
1361+
type :class:`int` or :class:`float` and a non-integral exponent, a complex
1362+
result is delivered. For example, ``pow(-9, 0.5)`` returns a value close
1363+
to ``3j``.
13611364

13621365
For :class:`int` operands *base* and *exp*, if *mod* is present, *mod* must
13631366
also be of integer type and *mod* must be nonzero. If *mod* is present and

0 commit comments

Comments
 (0)