[Numpy-tickets] [NumPy] #646: incorrect calculation on int64 array
NumPy
numpy-tickets@scipy....
Sat Jan 19 08:07:41 CST 2008
#646: incorrect calculation on int64 array
-----------------------+----------------------------------------------------
Reporter: latrine00 | Owner: somebody
Type: defect | Status: new
Priority: high | Milestone: 1.0.5
Component: Other | Version: none
Severity: major | Keywords: array int64
-----------------------+----------------------------------------------------
I get curious results on array calculation in numpy 1.0.4
Example code in python:
{{{
import numpy
a = numpy.arange(0, 200, 2, dtype='int64')
np = (a+1)**1
print a
print np
}}}
Second array np contains even numbers - should be odd only:
{{{
array([ 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24,
26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50,
52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76,
78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102,
104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128,
130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 152, 154,
156, 158, 160, 162, 164, 166, 168, 170, 172, 174, 176, 178, 180,
182, 184, 186, 188, 190, 192, 194, 196, 198], dtype=int64)
array([ 1, 3, 5, 7, 9, 11, 12, 15, 17, 19, 20, 22, 24,
27, 28, 30, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51,
53, 54, 57, 58, 60, 62, 64, 66, 68, 71, 72, 74, 77,
79, 81, 82, 85, 86, 89, 91, 93, 95, 96, 99, 101, 103,
105, 107, 108, 111, 112, 115, 117, 119, 120, 123, 124, 127, 129,
131, 132, 135, 137, 139, 141, 142, 144, 147, 148, 151, 153, 154,
157, 159, 161, 163, 164, 166, 168, 171, 173, 175, 176, 179, 181,
182, 185, 187, 188, 190, 192, 194, 197, 199], dtype=int64)
}}}
--
Ticket URL: <http://scipy.org/scipy/numpy/ticket/646>
NumPy <http://projects.scipy.org/scipy/numpy>
The fundamental package needed for scientific computing with Python.
More information about the Numpy-tickets
mailing list