[Numpy-discussion] adding unsigned int and int

Matthew Brett matthew.brett at gmail.com
Tue Dec 6 07:53:08 EST 2011


Hi,

On Tue, Dec 6, 2011 at 4:45 AM, Skipper Seabold <jsseabold at gmail.com> wrote:
> Hi,
>
> Is this intended?
>
> [~/]
> [1]: np.result_type(np.uint, np.int)
> [1]: dtype('float64')

I would guess so - if your system ints are 64 bit.  int64 can't
contain the range for uint64, nor can uint64 contain all int64,  If
there had been a larger int type, it would promote to int, I believe.
At least on my system:

In [4]: np.result_type(np.int32, np.uint32)
Out[4]: dtype('int64')

Best,

Matthew



More information about the NumPy-Discussion mailing list