When is min(a, b) != min(b, a)?

Bonjour peixu.zhu at gmail.com
Sun Jan 20 23:12:19 EST 2008


'NaN' means "Not a number". according to Python semantics, if you try
to compare it with any other float numbers, it should return FALSE.
just like:

   >>>1.0 > 'abc'
      False

Since it always return FALSE, it is not a surprise for your question.

If you wish to get infinitive number, you'd use 'inf' for positive
infinitive or '-inf' for negative infinitive, from
IEEE 754 semantics, just like:

  >>>a=float(6)
  >>>b=float('inf')
  >>>c=float('-inf')

For more information, PEP-0754 may be helpful.



More information about the Python-list mailing list