[issue46780] Allow Fractions to return 1/6 for "0.17", "0.167", "0.1667", etc.

Lee Newberg report at bugs.python.org
Thu Feb 17 13:40:04 EST 2022


Lee Newberg <github at quantconsulting.com> added the comment:

>This sounds interesting, but also rather similar to what the `limit_denominator` method can get you. 

`Fractions("0.17").limit_denominator()` and `Fractions("0.17").limit_denominator(n)`
for n > 28 do not give 1/6.  So, I'd have to guess at n until I get 1/6.  Instead, I'd like to have the digits actually presented "0.17" determine the interval [0.165, 0.175) which then determines the fraction.

In particular, "0.170" would give a different answer ... a fraction within [0.1695, 0.1705).

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46780>
_______________________________________


More information about the Python-bugs-list mailing list