[Numpy-discussion] A bug in creating array of long int.

Perry Greenfield perry at stsci.edu
Sat Sep 18 13:55:00 EDT 2004

Daehyok Shin (Peter) wrote:

> I got the following strange value when converting a long integer into
> numarray. I spent some time in tracking it down in my program.
> Is it a bug or an expected one? Thanks.
> >>> array([True])
> array([1], type=Bool)
> >>> array([1])
> array([1])
> >>> array([1L]) # How about preserving long int type?
> array([1])
> >>> array([10000000000000000L])
> array([1874919424])  # Oops. The value is changed without any notice.
So, what were you hoping would happen? An exception? Automatically setting
type to Int64? (and if that case, what about values too large for Int64s?)
(I'm assuming you are aware that Python longs are not 64 bit ints).

This probably could be handled better. We'll look into it.


More information about the NumPy-Discussion mailing list