On Jan 24, 7:09 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > I'm having a lot of trouble finding the canonical IEEE-754 standard, so > I'm forced to judge by implementations and third party accounts. For > example, this is what IBM says:
There's a recent draft of IEEE 754r (the upcoming revision to IEEE 754) at http://www.validlab.com/754R/drafts/archive/2007-10-05.pdf Sections 5.11 and 5.3.1 deal with comparison predicates and the maxnum/ minnum operations, respectively. One of the problems here is that Python's == operator is used for two different purposes: first, for numeric comparisons (where in some sense it's semi-reasonable for NaN == NaN to return False, or raise an exception), and second, for structural operations like checking set or dict membership. Most of the time there's not too much conflict here, but while I fully expect 2 == Decimal('2.0') to return True, it still occasionally feels funny to me that I can't have Decimal("2.0") and the integer 2 be different keys in a dict: certainly they're numerically equal, but they're still fundamentally different objects, dammit! Any change to Python that made == and != checks involving NaNs raise an exception would have to consider the consequences for set, dict, list membership testing. Mark and if Python had separate operators for these two purposes it wouldn't be Python any more. Mark -- http://mail.python.org/mailman/listinfo/python-list