diff options
author | Sergey B Kirpichev <skirpichev@gmail.com> | 2023-02-27 19:11:28 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-27 19:11:28 (GMT) |
commit | 4624987b296108c2dc1e6e3a24e65d2de7afd451 (patch) | |
tree | 0a490563b4c31f14740e72ce6b3ef0c0c1a3e2e8 /Doc/library/stdtypes.rst | |
parent | 4f3786b7616dd464242b88ad6914053d409fe9d2 (diff) | |
download | cpython-4624987b296108c2dc1e6e3a24e65d2de7afd451.zip cpython-4624987b296108c2dc1e6e3a24e65d2de7afd451.tar.gz cpython-4624987b296108c2dc1e6e3a24e65d2de7afd451.tar.bz2 |
gh-101825: Clarify that as_integer_ratio() output is always normalized (#101843)
Make docstrings for `as_integer_ratio` consistent across types, and document that
the returned pair is always normalized (coprime integers, with positive denominator).
---------
Co-authored-by: Owain Davies <116417456+OTheDev@users.noreply.github.com>
Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
Diffstat (limited to 'Doc/library/stdtypes.rst')
-rw-r--r-- | Doc/library/stdtypes.rst | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index 41947d6..1240f80 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -602,8 +602,8 @@ class`. In addition, it provides a few more methods: .. method:: int.as_integer_ratio() - Return a pair of integers whose ratio is exactly equal to the original - integer and with a positive denominator. The integer ratio of integers + Return a pair of integers whose ratio is equal to the original + integer and has a positive denominator. The integer ratio of integers (whole numbers) is always the integer as the numerator and ``1`` as the denominator. @@ -624,7 +624,7 @@ class`. float also has the following 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 + original float. The ratio is in lowest terms and has a positive denominator. Raises :exc:`OverflowError` on infinities and a :exc:`ValueError` on NaNs. |