> Thank you both for your replies - the difference is clear to me now.

Actually, sorry, I'm still confused!


If I want to be able to have a/0 be inf (for a!=0), then why does that 
stop 0/0 from being nan?

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?

seterr(divide='ignore')
a=array([0],dtype=float_)
b=array([0],dtype=float_)
divide(a,b)

gives nan, so why doesn't

seterr(divide='ignore')
a=array([0],dtype=int_)
b=array([0],dtype=int_)
divide(a,b)

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?


I'm not at all knowledgeable in this area - I'm not requesting any 
changes, just some more explanation.


Thanks again,
Chris


_______________________________________________
Numpy-discussion mailing list
[email protected]
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to