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]: np.float64(2**63-1) == np.float(2**63-1) > Out[16]: True
Interesting. Turns out that np.float(x) returns a Python float object. If you change the experiment to only use numpy array scalars, things are more consistent: In [36]: np.array(2**63, dtype=np.float) > 2**63 - 1 Out[36]: False In [37]: np.array(2**63, dtype=np.float32) > 2**63 - 1 Out[37]: False In [38]: np.array(2**63, dtype=np.float64) > 2**63 - 1 Regards Stéfan _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion