[Python-checkins] cpython (2.7): #15438: add a note to math.pow() that suggests using **/pow() for integers.
ezio.melotti
python-checkins at python.org
Sat Feb 23 03:56:03 CET 2013
http://hg.python.org/cpython/rev/ad0712f4b3e0
changeset: 82321:ad0712f4b3e0
branch: 2.7
parent: 82317:3213fe4a72e0
user: Ezio Melotti <ezio.melotti at gmail.com>
date: Sat Feb 23 04:53:44 2013 +0200
summary:
#15438: add a note to math.pow() that suggests using **/pow() for integers. Patch by Mark Dickinson.
files:
Doc/library/math.rst | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/Doc/library/math.rst b/Doc/library/math.rst
--- a/Doc/library/math.rst
+++ b/Doc/library/math.rst
@@ -212,6 +212,10 @@
``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.
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list