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]: res[0] > 2**31-1
> Out[13]: True
>
> In [14]: res[0].dtype
> Out[14]: dtype('float32')

I'm seeing:

In [7]: res = np.array((2**31,), dtype=np.float32)

In [9]: res > (2**31-1)
Out[9]: array([ True], dtype=bool)

In [10]: res[0]
Out[10]: 2.1474836e+09

In [11]: res[0] > (2**31-1)
Out[11]: True

Your result seems very strange, because the numpy scalars should
perform exactly the same inside and outside an array.

Stéfan
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to