From: Benyang T. <bt...@pa...> - 2002-06-12 16:34:45
|
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 |