12 Jun
2002
12 Jun
'02
11:35 a.m.
The sum of an Int32 array and a Float32 array is a Float64 array, as shown by the following code: a = Numeric.array([1,2,3,4],'i') a.typecode(), a.itemsize() b = Numeric.array([1,2,3,4],'f') b.typecode(), b.itemsize() c=a+b c.typecode(), c.itemsize()
a = Numeric.array([1,2,3,4],'i') a.typecode(), a.itemsize() ('i', 4)
b = Numeric.array([1,2,3,4],'f') b.typecode(), b.itemsize() ('f', 4) c=a+b c.typecode(), c.itemsize() ('d', 8)
Why is the upcasting? I am using Linux/Pentium/python2.1/numpy20 . Thanks. Benyang Tang