On 4/22/07, Charles R Harris <[EMAIL PROTECTED]> wrote:
On 4/22/07, Christian Marquardt <[EMAIL PROTECTED]> wrote: > > Hello, > > The following is what I expected... > > >>> y = 1234 > >>> x = array([1], dtype = "uint64") > >>> print x + y, (x + y).dtype.type > [1235] <type ' numpy.uint64'> > > but is this the way it should be? (numpy 1.0.2, Linux, Intel comilers) > > >>> print x[0] + y, type(x[0] + y) > 1235.0 <type 'numpy.float64'> Looks like a bug to me: In [5]: x = array([1],dtype=uint64) In [6]: type(x[0]) Out[6]: <type 'numpy.uint64'> In [7]: type(x[0]+1) Out[7]: <type 'numpy.float64'>
Python integers should have enough precision to hold the result, although a long integer would have to be used. I suspect this is an artifact of considering regular python integers, which don't have the needed precision, hence the double (which is a bit small itself). Chuck
_______________________________________________ Numpy-discussion mailing list [email protected] http://projects.scipy.org/mailman/listinfo/numpy-discussion
