[Python-Dev] PEP239 (Rational Numbers) Reference Implementation and new issues

Andrew Koenig ark at research.att.com
Thu Oct 3 16:45:27 CEST 2002

Christopher> For what it's worth, the current implementation is
Christopher> nothing this complicated.  Like every other numeric
Christopher> operation, compares of rationals with floats coerce to
Christopher> floats.  So as a result rational(x)==float(x) iff
Christopher> float(rational(x))==float(x).

Attractive as this strategy may be from an implementation viewpoint,
it means that comparisons do not have the order-relation properties
that algorithms such as sort expect.

A similar problem exists today for comparisons between float and long,
by the way.

Andrew Koenig, ark at research.att.com, http://www.research.att.com/info/ark

More information about the Python-list mailing list