[Numpy-discussion] What is the logical value of nan?

Sturla Molden sturla@molden...
Wed Mar 11 07:18:51 CDT 2009


Charles R Harris wrote:
>
>     #include <math.h>
>     #include <stdio.h>
>
>     int main() {
>        double nan = sqrt(-1);
>        printf("%f\n", nan);
>        printf("%i\n", bool(nan));
>        return 0;
>     }
>
>     $ ./nan
>     nan
>     1
>
>
> So resolved, it is True.
Unless specified in the ISO C standard, I'd say this is system and 
compiler dependent.

Should NumPy rely on a specific binary representation of NaN?

A related issue is the boolean value of Inf and -Inf.

Sturla Molden


More information about the Numpy-discussion mailing list