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

Stéfan van der Walt stefan@sun.ac...
Tue Mar 10 16:16:54 CDT 2009


2009/3/10 Pauli Virtanen <pav@iki.fi>:
> Nonzero Python object, hence True. Moreover, it's also True in Python:

Also in C:

#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

Cheers
Stéfan


More information about the Numpy-discussion mailing list