When is min(a, b) != min(b, a)?
Mark Dickinson
dickinsm at gmail.com
Mon Jan 28 09:40:23 EST 2008
On Jan 28, 6:50 am, Antoon Pardon <apar... at forel.vub.ac.be> wrote:
> My personal preference would be that python would allow people the
> choice, with the default being that any operation that resulted
> in a non numeric result would throw an exception.
>
> People who somehow made it clear they know how to work with inf, and
> NaN results, would get silent NaN where no exceptions would be thrown.
I also think this would be the ideal situation. Getting there would
require a lot of thought, planning, a PEP or two, and some hard work
and tricky coding to deal with all the different ways that the C
compiler, libm and hardware might try to mess things up. Right now
I don't have time for this :-( Anyone else?
> > Putting aside sorting and max/min, what is the use-case for having
> > comparisons with NaN succeed? What benefit will it give you?
>
> I guess the same benefit it gives to those that have operations with
> NaN succeed. If 3 * NaN should succeed and all sort of other stuff,
> why suddenly make an exception for 3 < NaN.
Right. This is especially true when the result of the comparison is
treated as number (i.e. 0 or 1) rather than as a boolean,
and goes back into the calculation in some way. On the other hand,
there are certainly situations where you want a comparison with a
NaN to raise an exception. I guess this is why IEEE-754r provides
two sets of comparison operators: signaling and non-signaling.
Mark
More information about the Python-list
mailing list