Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 739d549

Browse files
committed
#15438: add a note to math.pow() that suggests using **/pow() for integers. Patch by Mark Dickinson.
1 parent ad17bc0 commit 739d549

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

Doc/library/math.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,10 @@ Power and logarithmic functions
202202
``x`` is negative, and ``y`` is not an integer then ``pow(x, y)``
203203
is undefined, and raises :exc:`ValueError`.
204204

205+
Unlike the built-in ``**`` operator, :func:`math.pow` converts both
206+
its arguments to type :class:`float`. Use ``**`` or the built-in
207+
:func:`pow` function for computing exact integer powers.
208+
205209

206210
.. function:: sqrt(x)
207211

0 commit comments

Comments
 (0)