Python的奇数运算? [英] Python odd operation?

查看:79
本文介绍了Python的奇数运算?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以请我解释一下下面的代码为何如此运行吗? (在Windows7 x64上的命令行中为Python)

Can somebody please explain me why the code below behaves like it does? (It's Python in command line on Windows7 x64)

>>>2.22 + 0.22
2.44000000000000004
>>>(222+22)/100
2.44

推荐答案

浮点运算在精度方面受到限制,而在python中,这种局限性已得到充分证明.您可以在此处

Floating point operations are limited in percision, and in python the limitations are well documented. You can read about it here

这篇关于Python的奇数运算?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆