[Numpy-discussion] NumPy's integer arithmetics differs from Numeric

Sasha ndarray at mac.com
Sun Jan 15 21:40:03 CST 2006


It looks like NumPy and Numeric handle invalid integer operations differently:

>>> from numpy import *
>>> import Numeric as n
>>> array(2)**40
2147483647
>>> array(2)/0
0

In numeric both fail:
>>> n.array(2)**40
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
ArithmeticError: Integer overflow in power.
>>> n.array(2)/0
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
ZeroDivisionError: divide by zero

I don't know if the change was intentional, but if it was, I think it
should be advertised.

-- sasha




More information about the Numpy-discussion mailing list