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

David Cournapeau david@ar.media.kyoto-u.ac...
Mon Sep 29 22:07:03 CDT 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