'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' or '-inf', from IEEE 754 semantics: >>>a=float(6) >>>b=float('inf') >>>c=float('-inf') Albert Hopkins wrote: > This issue may have been referred to in > news:<[EMAIL PROTECTED]> but I didn't > entirely understand the explanation. Basically I have this: > > >>> a = float(6) > >>> b = float('nan') > >>> min(a, b) > 6.0 > >>> min(b, a) > nan > >>> max(a, b) > 6.0 > >>> max(b, a) > nan > > Before I did not know what to expect, but I certainly didn't expect > this. So my question is what is the min/max of a number and NaN or is it > not defined (for which I would have expected either an exception to be > raised or NaN returned in each case). > > As a corrollary would I be able to rely on the above behavior or is it > subject to change (to fix a bug in min/max perhaps :-)? -- http://mail.python.org/mailman/listinfo/python-list