Lee Newberg added the comment:
I have started a discussion at
https://discuss.python.org/t/allow-fractions-fraction-to-return-1-6-for-0-17-0-167-0-1667-etc
. Your feedback there would be much appreciated.
--
___
Python tracker
<ht
Lee Newberg added the comment:
In case there are others who are unsure about "python-ideas" ... I believe the
discussion page https://discuss.python.org/c/ideas is what was meant.
--
___
Python tracker
<https://bugs.python.o
Lee Newberg added the comment:
> Please watch the tone. It is borderline abusive and dismissive.
I apologize for the adverse impact there. I will be more careful.
> Also, my expectation for Fraction("0.0015") would be to give Fraction(3,
> 2000), the same as would b
Lee Newberg added the comment:
> The 12 semitones in an octave are separated ...
Right, this functionality would not solve the semitones / cents problem. Nor
will it achieve world peace. But if it solves enough use cases then it is
worth discussing, yes?
I haven't written th
Lee Newberg added the comment:
> 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.
You would win that bet.
--
___
Python tracker
Lee Newberg added the comment:
>It would return 1/7 for "0.1" and 1/4 for "0.2". Is it what you expected?
I answered "yes" before, but I am now thinking "no". In the case of "0.1", the
smallest numerator achievable is 1, but there are
Lee Newberg added the comment:
The example of "16e2" would yield the interval [1550, 1650). The smallest
denominator possible is 1. The smallest numerator that works with that
denominator is 1550, but I don't like 1550/1 as the answer.
To cover these edge cases,
Lee Newberg added the comment:
> One more example: what interval is implied by an input string of "1600"? Is
> it (1550, 1650)? Or (1595, 1605)? Or even (1599.5, 1600.5).
The rule would be to look at the last digit supplied and assume that the
rounding is there. So &quo
Lee Newberg added the comment:
> You may be interested in the "simplefractions" module on PyPI, which solves
> the exact task "find the simplest fraction in a given interval".
I haven't seen that code and I am interested; I will take a look. Perhaps c
Lee Newberg added the comment:
> For another problematic example, suppose the string supplied is "0.10"
We would treat "0.1", "0.10", "0.100", etc. all differently. In all cases we
would assume rounding to compute the last digit. Similarly for
Lee Newberg added the comment:
> depending on which rounding mode was used (round-ties-to-even,
> round-ties-to-away), the interval may be half-open, open or closed.
I think we will get the majority of the use cases if we pick one rounding
strategy and stick with it. In later vers
Lee Newberg added the comment:
>It would return 1/7 for "0.1" and 1/4 for "0.2". Is it what you expected?
Yes. Or putting it another way, if that's not the right answer then whoever
rounded the number shou
Lee Newberg 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
New submission from Lee Newberg :
For example, a string such as "0.167" could be rounded from anything in
[0.1665, 0.1675). Within that interval, the fraction with the lowest numerator
and denominator is 1/6.
Here it is proposed that we add a new flag to the Fractions constructor
14 matches
Mail list logo