Message349390
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:05 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, rhettinger, mark.dickinson, stutzbach |
2019-08-11 13:55:05 | serhiy.storchaka | set | messageid: <1565531705.4.0.857062617038.issue37822@roundup.psfhosted.org> |
2019-08-11 13:55:05 | serhiy.storchaka | link | issue37822 messages |
2019-08-11 13:55:05 | serhiy.storchaka | create | |
|