Re: [Numpy-discussion] float64 / int comparison different from float / int comparison

2011-11-01 Thread Chris.Barker
On 10/31/11 6:38 PM, Stéfan van der Walt wrote: On Mon, Oct 31, 2011 at 6:25 PM, Matthew Brettmatthew.br...@gmail.com wrote: Oh, dear, I'm suffering now: In [12]: res 2**31-1 Out[12]: array([False], dtype=bool) I'm seeing: ... Your result seems very strange, because the numpy scalars

Re: [Numpy-discussion] float64 / int comparison different from float / int comparison

2011-11-01 Thread Matthew Brett
Hi, On Tue, Nov 1, 2011 at 8:39 AM, Chris.Barker chris.bar...@noaa.gov wrote: On 10/31/11 6:38 PM, Stéfan van der Walt wrote: On Mon, Oct 31, 2011 at 6:25 PM, Matthew Brettmatthew.br...@gmail.com   wrote: Oh, dear, I'm suffering now: In [12]: res  2**31-1 Out[12]: array([False],

[Numpy-discussion] float64 / int comparison different from float / int comparison

2011-10-31 Thread Matthew Brett
Hi, I just ran into this confusing difference between np.float and np.float64: In [8]: np.float(2**63) == 2**63 Out[8]: True In [9]: np.float(2**63) 2**63-1 Out[9]: True In [10]: np.float64(2**63) == 2**63 Out[10]: True In [11]: np.float64(2**63) 2**63-1 Out[11]: False In [16]:

Re: [Numpy-discussion] float64 / int comparison different from float / int comparison

2011-10-31 Thread Stéfan van der Walt
On Mon, Oct 31, 2011 at 11:23 AM, Matthew Brett matthew.br...@gmail.com wrote: In [8]: np.float(2**63) == 2**63 Out[8]: True In [9]: np.float(2**63) 2**63-1 Out[9]: True In [10]: np.float64(2**63) == 2**63 Out[10]: True In [11]: np.float64(2**63) 2**63-1 Out[11]: False In [16]:

Re: [Numpy-discussion] float64 / int comparison different from float / int comparison

2011-10-31 Thread Matthew Brett
Hi, 2011/10/31 Stéfan van der Walt ste...@sun.ac.za: On Mon, Oct 31, 2011 at 11:23 AM, Matthew Brett matthew.br...@gmail.com wrote: In [8]: np.float(2**63) == 2**63 Out[8]: True In [9]: np.float(2**63) 2**63-1 Out[9]: True In [10]: np.float64(2**63) == 2**63 Out[10]: True In [11]:

Re: [Numpy-discussion] float64 / int comparison different from float / int comparison

2011-10-31 Thread Stéfan van der Walt
On Mon, Oct 31, 2011 at 6:25 PM, Matthew Brett matthew.br...@gmail.com wrote: Oh, dear, I'm suffering now: In [11]: res = np.array((2**31,), dtype=np.float32) In [12]: res 2**31-1 Out[12]: array([False], dtype=bool) OK - that's what I was expecting from the above, but now: In [13]: