[Python-Dev] PEP239 (Rational Numbers) Reference Implementation and new issues (original) (raw)
Christopher A. Craig python-pep@ccraig.org
03 Oct 2002 09:20:27 -0400
- Previous message: [Python-Dev] PEP239 (Rational Numbers) Reference Implementation and new issues
- Next message: [Python-Dev] PEP239 (Rational Numbers) Reference Implementation and new issues
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
"Eric S. Raymond" <esr@thyrsus.com> writes:
APL faced this problem twenty-five years ago. I like its solution; a `fuzz' variable defining the close-enough-for-equality range.
For what it's worth, the current implementation is nothing this complicated. Like every other numeric operation, compares of rationals with floats coerce to floats. So as a result rational(x)==float(x) iff float(rational(x))==float(x).
That is, of course, much more permissive than if we coerced the other way and had rational(x)==float(x) iff rational(x)==rational(float(x)).
-- Christopher A. Craig <python-pep@ccraig.org> "You could shoot Microsoft Office off the planet and this country would run better. You would see everyone standing around saying, 'I've got so much time now.' " Scott McNealy (CEO of Sun)
- Previous message: [Python-Dev] PEP239 (Rational Numbers) Reference Implementation and new issues
- Next message: [Python-Dev] PEP239 (Rational Numbers) Reference Implementation and new issues
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]