[Python-ideas] Python Float Update

random832 at fastmail.us random832 at fastmail.us
Mon Jun 1 05:14:06 CEST 2015


On Sun, May 31, 2015, at 22:25, u8y7541 The Awesome Person wrote:
> First, I propose that a float's integer ratio should be accurate. For
> example, (1 / 3).as_integer_ratio() should return (1, 3). Instead, it
> returns(6004799503160661, 18014398509481984).

Even though he's mistaken about the core premise, I do think there's a
kernel of a good idea here - it would be nice to have a method (maybe
as_integer_ratio, maybe with some parameter added, maybe a different
method) to return with the smallest denominator that would result in
exactly the original float if divided out, rather than merely the
smallest power of two.


More information about the Python-ideas mailing list