[Numpy-discussion] [Bug] important bug in method sum
humufr at yahoo.fr
humufr at yahoo.fr
Tue Feb 5 14:58:40 EST 2008
Hello,
when doing some test I saw a very important bug in numpy (at least on the svn
version and 1.0.3 (ubuntu package)).
I'm using a svn version of numpy:
In [31]: numpy.__version__
Out[31]: '1.0.5.dev4767'
The problem is for an array larger than 256*256 the sum is going crazy.
In [45]: numpy.arange(256*256)
Out[45]: array([ 0, 1, 2, ..., 65533, 65534, 65535])
In [46]: numpy.arange(256*256).sum()
Out[46]: 2147450880
In [47]: numpy.arange(257*257)
Out[47]: array([ 0, 1, 2, ..., 66046, 66047, 66048])
In [48]: numpy.arange(257*257).sum()
Out[48]: -2113765120
>>> import numpy
>>> numpy.arange(256*256).sum()
2147450880
>>> numpy.arange(257*257).sum()
-2113765120
>>> numpy.__version__
'1.0.3'
Sorry for this bad news.
N.
ps: my system is an ubuntu linux 32
More information about the NumPy-Discussion
mailing list