[Numpy-discussion] What is the sign of nan?

David Cournapeau david at ar.media.kyoto-u.ac.jp
Mon Sep 29 23:07:03 EDT 2008


Charles R Harris wrote:
>
> Thanks, that was very helpful. I wonder how widespread the less,
> lessequal, etc. macros are?

If it is C99, count on some platforms (MS in particular) to not do it.
Also, when doing things in C, beware that some compilers break most
reasonable expectations about floating points. In particular, x - x
where x is a NaN or inf will returns 0 with MS compilers with the
compiler flags currently used in python (/Ox), which breaks almost any
code out there relying on proper NaN/Inf handling. So if possible,
special case with isnan/isinf/isfinite

cheers,

David





More information about the NumPy-Discussion mailing list