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

Matthew Brett matthew.brett@gmail....
Mon Oct 31 13:23:30 CDT 2011


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]: np.float64(2**63-1) == np.float(2**63-1)
Out[16]: True

I believe values above 2*52 are all represented as integers in float64.


Is this this int64 issue that came up earlier in float128 comparison?
Why the difference between np.float and np.float64?

Thanks for any insight,


More information about the NumPy-Discussion mailing list