This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients mark.dickinson, rhettinger, serhiy.storchaka, stutzbach
Date 2019-08-11.13:55:05
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
There are two interfaces to represent a number as a ratio. The numbers.Rational interface has two properties: numerator and denominator. float and Decimal do not support this interface, but they provide method as_integer_ratio() which return a 2-tuple (numerator, denominator).

I propose to add math.as_integer_ratio() which unites both interfaces: uses the as_integer_ratio() method if it is defined, and uses the numerator and denominator properties otherwise. It will help in applications that work with exact numbers (e.g. modules fractions and statistics).
Date User Action Args
2019-08-11 13:55:05serhiy.storchakasetrecipients: + serhiy.storchaka, rhettinger, mark.dickinson, stutzbach
2019-08-11 13:55:05serhiy.storchakasetmessageid: <>
2019-08-11 13:55:05serhiy.storchakalinkissue37822 messages
2019-08-11 13:55:05serhiy.storchakacreate