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

Pete Forman pete.forman at westerngeco.com
Thu Oct 2 05:50:59 EDT 2008


"Stéfan van der Walt" <stefan at 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 at westerngeco.com    -./\.-   the opinion of Schlumberger or
http://petef.22web.net           -./\.-   WesternGeco.




More information about the NumPy-Discussion mailing list