[Numpy-discussion] Int casting different across platforms

Matthew Brett matthew.brett at gmail.com
Fri Nov 4 19:21:03 EDT 2011


Hi,

I noticed this:

(Intel Mac):

In [2]: np.int32(np.float32(2**31))
Out[2]: -2147483648

(PPC):

In [3]: np.int32(np.float32(2**31))
Out[3]: 2147483647

I assume what is happening is that the casting is handing off to the c
library, and that behavior of the c library differs on these
platforms?  Should we expect or hope that this behavior would be the
same across platforms?

Thanks for any pointers,

Matthew



More information about the NumPy-Discussion mailing list