[Numpy-discussion] 0/0 is 0 or nan?
Tue Mar 13 23:30:17 CDT 2007
Christopher Ball wrote:
> In Python, a/0 gives a divide-by-zero error for any a, but in numpy, I
> can ignore divide-by-zero errors. If I do this, why can't I still have
> 0/0 be nan?
> gives nan, so why doesn't
> also give nan, rather than 0 as it gives now? Is this because inf is not
> something to which an int can be set (as Christopher Barker wrote), and
> it matches Python's behavior?
Pretty much. ints operated with ints will give ints, not floats. nan and inf are
floating point concepts.
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
More information about the Numpy-discussion