[Numpy-discussion] Unwanted upcast from uint64 to float64

Torgil Svensson torgil.svensson at gmail.com
Thu Aug 31 01:15:36 CDT 2006


I'm using windows datetimes (100nano-seconds since 0001,1,1) as time
in a numpy array and was hit by this behaviour.

>>> numpy.__version__
'1.0b4'
>>> a=numpy.array([632925394330000000L],numpy.uint64)
>>> t=a[0]
>>> t
632925394330000000L
>>> type(t)
<type 'numpy.uint64'>
>>> t+1
6.3292539433e+017
>>> type(t+1)
<type 'numpy.float64'>
>>> t==(t+1)
True

I was trying to set t larger than any time in an array. Is there any
reason for the scalar to upcast in this case?

//Torgil




More information about the Numpy-discussion mailing list