diff options
author | Andrew M. Kuchling <amk@amk.ca> | 2008-09-13 02:11:51 (GMT) |
---|---|---|
committer | Andrew M. Kuchling <amk@amk.ca> | 2008-09-13 02:11:51 (GMT) |
commit | 09e80938b0c034f4fd1d828562d0714e968e42ad (patch) | |
tree | 14f88bd0903dd661b702bda0c2c3f5cb9b14d22e /Doc | |
parent | bf64c0411fd54d81f1bc7a45b35c0a0557ac4899 (diff) | |
download | cpython-09e80938b0c034f4fd1d828562d0714e968e42ad.zip cpython-09e80938b0c034f4fd1d828562d0714e968e42ad.tar.gz cpython-09e80938b0c034f4fd1d828562d0714e968e42ad.tar.bz2 |
#3288: Document as_integer_ratio
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/stdtypes.rst | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index 6802f30..737ea97 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -449,7 +449,18 @@ Notes: Additional Methods on Float --------------------------- -The float type has some additional methods to support conversion to +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. + + .. versionadded:: 2.6 + +Two methods support conversion to and from hexadecimal strings. Since Python's floats are stored internally as binary numbers, converting a float to or from a *decimal* string usually involves a small rounding error. In |