[Python-Dev] Fraction arithmetic (Was: Decimal ... float comparisons in py3k)

Paul Moore p.f.moore at gmail.com
Sat Mar 20 12:41:36 CET 2010

On 20 March 2010 04:20, Nick Coghlan <ncoghlan at gmail.com> wrote:
> In the case of floats and Decimals, there's no ambiguity here that
> creates any temptation to guess - to determine a true/false result for a
> comparison, floats can be converted explicitly to Decimals without any
> loss of accuracy. For Fractions, the precedent has already been set by
> allowing implicit (potentially lossy) conversion to binary floats - a
> lossy conversion to Decimal wouldn't be any worse.

Hmm, given that a float can be converted losslessly to a fraction, why
was the decision taken to convert the fraction to a float rather than
the other way round?

I don't see a PEP for the fractions module, and my google-fu has
failed to find anything. Was there a discussion on this?


More information about the Python-Dev mailing list