[Numpy-discussion] Integer Overflow?
Tue Jul 14 09:42:56 CDT 2009
> I got stung when taking an ordinary python integer to the power of a numpy
> integer - the result wasn't what I was expecting (see below)!
From the results below, it seems to be okay if the base is a long.
Note the type of the returned result in each case. Does it seem
inconsistent to return a numpy.float64 in one instance and a pure python
float in another?
Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit
(Intel)] on win32
Type "copyright", "credits" or "license" for more information.
Option: import all optional modules
>>> import numpy as np
>>> out = 10**-10
>>> out = 10**np.int32(-10)
>>> out = 10L**np.int32(-10)
More information about the NumPy-Discussion