[Python-ideas] Python Float Update

random832 at fastmail.us random832 at fastmail.us
Mon Jun 1 07:11:10 CEST 2015


On Mon, Jun 1, 2015, at 00:37, Cameron Simpson wrote:
> Probably the same as Euler's greatest common factor method. About log(n)
> I 
> think. Take as_integer_ratio, find greatest common factor, divide both by
> that.

Er, no, because (6004799503160661, 18014398509481984) are already
mutually prime, and we want (1, 3). This is a different problem from
finding a reduced fraction. There are algorithms, I know, for
constraining the denominator to a specific range
(Fraction.limit_denominator does this), but that's not *quite* the same
as finding the lowest one that will still convert exactly to the
original float


More information about the Python-ideas mailing list