Numpy float64 vs Python float

后端 未结 1 1848
猫巷女王i
猫巷女王i 2020-12-15 02:56

I\'m battling some floating point problems in Pandas read_csv function. In my investigation, I found this:

In [15]: a = 5.9975

In [16]: a
Out[16]: 5.9975

         


        
相关标签:
1条回答
  • 2020-12-15 03:24
    >>> numpy.float64(5.9975).hex()
    '0x1.7fd70a3d70a3dp+2'
    >>> (5.9975).hex()
    '0x1.7fd70a3d70a3dp+2'
    

    They are the same number. What differs is their representation; the Python native type uses a "sane" representation, and the NumPy type uses an accurate representation.

    0 讨论(0)
提交回复
热议问题