mirror of
https://github.com/python/cpython.git
synced 2025-11-17 17:46:45 +00:00
Issue #10145: the float.is_integer method was undocumented.
This commit is contained in:
parent
35adf5dcf1
commit
4a3c7c4ecf
1 changed files with 14 additions and 4 deletions
|
|
@ -530,10 +530,20 @@ The float type has some additional methods.
|
||||||
|
|
||||||
.. method:: float.as_integer_ratio()
|
.. method:: float.as_integer_ratio()
|
||||||
|
|
||||||
Return a pair of integers whose ratio is exactly equal to the
|
Return a pair of integers whose ratio is exactly equal to the
|
||||||
original float and with a positive denominator. Raises
|
original float and with a positive denominator. Raises
|
||||||
:exc:`OverflowError` on infinities and a :exc:`ValueError` on
|
:exc:`OverflowError` on infinities and a :exc:`ValueError` on
|
||||||
NaNs.
|
NaNs.
|
||||||
|
|
||||||
|
.. method:: float.is_integer()
|
||||||
|
|
||||||
|
Return ``True`` if the float instance is finite with integral
|
||||||
|
value, and ``False`` otherwise::
|
||||||
|
|
||||||
|
>>> (-2.0).is_integer()
|
||||||
|
True
|
||||||
|
>>> (3.2).is_integer()
|
||||||
|
False
|
||||||
|
|
||||||
Two methods support conversion to
|
Two methods support conversion to
|
||||||
and from hexadecimal strings. Since Python's floats are stored
|
and from hexadecimal strings. Since Python's floats are stored
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue