]> granicus.if.org Git - python/commitdiff
Issue #10145: the float.is_integer method was undocumented.
authorMark Dickinson <dickinsm@gmail.com>
Sun, 7 Nov 2010 12:48:18 +0000 (12:48 +0000)
committerMark Dickinson <dickinsm@gmail.com>
Sun, 7 Nov 2010 12:48:18 +0000 (12:48 +0000)
Doc/library/stdtypes.rst

index 0ac870be217595541ac7e1ffdf09dc2925438ea1..9f2831a3161add041e68556a693e6d0df4003320 100644 (file)
@@ -530,10 +530,20 @@ The float type has some additional methods.
 
 .. method:: float.as_integer_ratio()
 
-    Return a pair of integers whose ratio is exactly equal to the
-    original float and with a positive denominator.  Raises
-    :exc:`OverflowError` on infinities and a :exc:`ValueError` on
-    NaNs.
+   Return a pair of integers whose ratio is exactly equal to the
+   original float and with a positive denominator.  Raises
+   :exc:`OverflowError` on infinities and a :exc:`ValueError` on
+   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
 and from hexadecimal strings.  Since Python's floats are stored