Discuss / Python / np.arange以步长为0.1的时候输出的怎么会有不对的?

np.arange以步长为0.1的时候输出的怎么会有不对的?

Topic source

血乀落

#1 Created at ... [Delete] [Delete and Lock User]

for i in np.arange(1, 5, .1): print(i)

输出: 1.0 1.1 1.2000000000000002 1.3000000000000003 1.4000000000000004 1.5000000000000004 1.6000000000000005 1.7000000000000006 1.8000000000000007 1.9000000000000008


  • 1

Reply