summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEzio Melotti <ezio.melotti@gmail.com>2013-02-23 02:53:44 (GMT)
committerEzio Melotti <ezio.melotti@gmail.com>2013-02-23 02:53:44 (GMT)
commit6a959a1213d4bb9cde122b0450984e4936273b65 (patch)
tree29e3cab00769032a8b75c71cb88975681b363af5
parent43b09d49b61e1f66177d10b6589678b0472599c1 (diff)
downloadcpython-6a959a1213d4bb9cde122b0450984e4936273b65.zip
cpython-6a959a1213d4bb9cde122b0450984e4936273b65.tar.gz
cpython-6a959a1213d4bb9cde122b0450984e4936273b65.tar.bz2
#15438: add a note to math.pow() that suggests using **/pow() for integers. Patch by Mark Dickinson.
-rw-r--r--Doc/library/math.rst4
1 files changed, 4 insertions, 0 deletions
diff --git a/Doc/library/math.rst b/Doc/library/math.rst
index 1df48fc..7c6f0b4 100644
--- a/Doc/library/math.rst
+++ b/Doc/library/math.rst
@@ -212,6 +212,10 @@ Power and logarithmic functions
``x`` is negative, and ``y`` is not an integer then ``pow(x, y)``
is undefined, and raises :exc:`ValueError`.
+ Unlike the built-in ``**`` operator, :func:`math.pow` converts both
+ its arguments to type :class:`float`. Use ``**`` or the built-in
+ :func:`pow` function for computing exact integer powers.
+
.. versionchanged:: 2.6
The outcome of ``1**nan`` and ``nan**0`` was undefined.