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

Mark Dickinson report at bugs.python.org
Thu Feb 17 14:08:20 EST 2022


Mark Dickinson <dickinsm at gmail.com> added the comment:

> I'd modify the optimization to be that we continue to seek the smallest denominator, but in the case that multiple numerators would give ratios within the computed interval then we choose the numerator among these that gives the ratio closest to the input value.

Hmm. This is getting more DWIM-like (Do What I Mean) by the minute. :-)

What about for an input of "0.001"? Your current specification would give 1/667, but I'm betting that you'd actually prefer 1/1000.

----------

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


More information about the Python-bugs-list mailing list