[Numpy-discussion] reciprocal(0)

Ralf Gommers ralf.gommers@googlemail....
Sat Jun 6 22:49:36 CDT 2009


I expect `reciprocal(x)` to calculate 1/x, and for input 0 to either follow
the python rules or give the np.divide(1, 0) result. However the result
returned (with numpy trunk) is:

>>> np.reciprocal(0)

>>> np.divide(1, 0)
>>> 1/0
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ZeroDivisionError: integer division or modulo by zero

The result for a zero float argument is inf as expected. I want to document
the correct behavior for integers, what should it be?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20090606/3667a1d0/attachment-0001.html 

More information about the Numpy-discussion mailing list