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

Stéfan van der Walt stefan at sun.ac.za
Tue Mar 10 17:16:54 EDT 2009


2009/3/10 Pauli Virtanen <pav at 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