为什么我在Python中将术语减去接近零时会有这种差异?

时间:2017-09-20 14:54:18

标签: python python-3.x math calculator

当我将其运行到编译器中时:

print (7/3)
print (4/3)
print (7/3-4/3-1)
print ("")
print (5/3)
print (2/3)
print (5/3-2/3-1)

控制台输出:

2.3333333333333335
1.3333333333333333
2.220446049250313e-16

1.6666666666666667
0.6666666666666666
0.0

为什么编译器在第16位用7/3到5?其他计算器说7/3仅为2.333(重复3) 另外,为什么编译器将解决方案围绕5/3但不是2/3?

0 个答案:

没有答案