mirror of https://github.com/python/cpython
#15438: add a note to math.pow() that suggests using **/pow() for integers. Patch by Mark Dickinson.
This commit is contained in:
parent
43b09d49b6
commit
6a959a1213
|
@ -212,6 +212,10 @@ Power and logarithmic functions
|
||||||
``x`` is negative, and ``y`` is not an integer then ``pow(x, y)``
|
``x`` is negative, and ``y`` is not an integer then ``pow(x, y)``
|
||||||
is undefined, and raises :exc:`ValueError`.
|
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
|
.. versionchanged:: 2.6
|
||||||
The outcome of ``1**nan`` and ``nan**0`` was undefined.
|
The outcome of ``1**nan`` and ``nan**0`` was undefined.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue