37,719
社区成员
发帖
与我相关
我的任务
分享
0.1000000000000000055511151231257827021181583404541015625 == 0.1
True
a = 0.1000000000000000055511151231257827021181583404541015625
print a
0.1
wind% python3
Python 3.5.1+ (default, Jan 13 2016, 15:09:18)
[GCC 5.3.1 20160101] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> format(0.1, ".20f")
'0.10000000000000000555'
只是python显示浮点数的方式变了.python3的文档说:
python2.7.11的相关文档: