[Numpy-discussion] 0/0 is 0 or nan?

Chris Ball ceball@gmail....
Thu Mar 8 19:01:41 CST 2007


Hi,

I noticed some behavior that seems inconsistent to me:

>>> from numpy import divide, seterr
>>> seterr(divide='ignore')
{'over': 'raise', 'divide': 'raise', 'invalid': 'raise', 'under': 'raise'}
>>> seterr()
{'over': 'raise', 'divide': 'ignore', 'invalid': 'raise', 'under': 'raise'}
>>> divide(0,0)
0
>>> divide(0.0,0.0)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
FloatingPointError: invalid value encountered in divide


Please could someone tell me whether this behavior comes from numpy or
elsewhere?

Thanks,
Chris


More information about the Numpy-discussion mailing list