Re: [Numpy-discussion] Int casting different across platforms

2011-11-05 Thread Matthew Brett
Hi, On Sat, Nov 5, 2011 at 6:24 PM, Charles R Harris charlesr.har...@gmail.com wrote: On Fri, Nov 4, 2011 at 5:21 PM, Matthew Brett matthew.br...@gmail.com wrote: Hi, I noticed this: (Intel Mac): In [2]: np.int32(np.float32(2**31)) Out[2]: -2147483648 (PPC): In [3]:

Re: [Numpy-discussion] Int casting different across platforms

2011-11-05 Thread Charles R Harris
On Sat, Nov 5, 2011 at 7:35 PM, Nathaniel Smith n...@pobox.com wrote: On Sat, Nov 5, 2011 at 4:07 PM, Matthew Brett matthew.br...@gmail.com wrote: Intel, gcc: 4, -2147483648 PPC, gcc: 4, 2147483647 I think that's what you predicted. Is it strange that the same compiler gives

Re: [Numpy-discussion] Int casting different across platforms

2011-11-05 Thread Matthew Brett
Hi, On Sun, Nov 6, 2011 at 2:39 AM, Charles R Harris charlesr.har...@gmail.com wrote: On Sat, Nov 5, 2011 at 7:35 PM, Nathaniel Smith n...@pobox.com wrote: On Sat, Nov 5, 2011 at 4:07 PM, Matthew Brett matthew.br...@gmail.com wrote: Intel, gcc: 4, -2147483648 PPC, gcc: 4, 2147483647

[Numpy-discussion] Int casting different across platforms

2011-11-04 Thread Matthew Brett
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