[Numpy-discussion] Different numpy.int64 in 64 bit platforms?
oliphant at ee.byu.edu
Tue Dec 26 18:05:20 CST 2006
Ivan Vilata i Balaguer wrote:
> I have come across this strange behaviour of NumPy 1.0.1 under a 64 bit
> AMD Opteron:
> I.e. the NumPy type used for ``long`` is not the same than for ``int``
> or explicit ``'int64'``, not even an instance. Is this a bug or is this
> kind of type comparisons discouraged? Thanks!
There is a NumPy type for each underlying c-type (i.e. int, long, short,
longlong). How many bits these have is platform dependent. Which of
these gets mapped to the name numpy.int64 is also platform dependent.
It is rare that you should be doing is-type comparisons on the type of
the array scalar.
Equality testing on the data-type object (the thing returned by the
dtype attribute of the ndarray and the array scalar) returns true if the
data-types are compatible. This is a more reliable test.
So, it's not a bug, but should be a FAQ.
More information about the Numpy-discussion