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

Paddy paddy3118 at googlemail.com
Thu Jan 24 10:12:14 EST 2008


On Jan 24, 2:28 pm, Christian Heimes <li... at cheimes.de> wrote:
> Antoon Pardon wrote:
> > That doesn't follow. The problem is not that x < nan returns False
> > because that is correct since x isn't smaller than nan. The problem
> > is cmp(x, nan) returning 1, because that indicates that x is greater
> > than nan and that isn't true.
>
> Please report the problem. cmp(), min() and max() don't treat NaNs
> right. I don't think that x < nan == False is the correct answer, too.
> But I've to check the IEEE 754 specs. IMHO < nan and > nan should raise
> an exception.
>
> Christian

To a floating point interested layman such as I, treating not-a-number
comparisons with floats should give the same result as comparing a
fileobject (also not-a-number), with a float. Or does nan have /need a
more domain specific interpretation?

- Paddy.



More information about the Python-list mailing list