[Numpy-discussion] nan, sign, and all that

Pete Forman pete.forman@westerngeco....
Thu Oct 2 04:50:59 CDT 2008

"Stéfan van der Walt" <stefan@sun.ac.za> writes:

 > Let me rephrase: I'm not convinced that these C99 semantics provide
 > an optimal user experience.  It worries me greatly that NaN's pop
 > up in operations and then disappear again.  It is entirely possible
 > for a script to run without failure and spew out garbage without
 > the user ever knowing.

By default NaNs are propagated through operations on them.  At the end
of this discussion we ought to end up with a list of functions such as
fmax, isnan, and copysign that are the exceptions.

I think that it is right to defer to IEEE for their decisions on the
behavior of NaNs, etc.  That is what C and Fortran are doing.  I have
not checked but I would guess that CPUs and FPUs behave that way too.
So it should be easier and faster to follow IEEE.

Note that in the just released Python 2.6 floating point support of
IEEE 754 has been beefed up.
Pete Forman                -./\.-  Disclaimer: This post is originated
WesternGeco                  -./\.-   by myself and does not represent
pete.forman@westerngeco.com    -./\.-   the opinion of Schlumberger or
http://petef.22web.net           -./\.-   WesternGeco.

More information about the Numpy-discussion mailing list