首页 > 分享 > 0.4

0.4

你注意过了么?

此处的运算结果是false。

这个是ruby上给的解释。哈哈,见识了。

Float objects have plenty of precision and can approximate 0.1 very well,

but the fact that this number cannot be represented exactly leads to problems.

Consider the following simple Ruby expression:

0.4 - 0.3 == 0.1 # Evaluates to false in most implementations

Because of rounding error, the difference between the approximations of 0.4 and 0.3 is

not quite the same as the approximation of 0.1. This problem is not specific to Ruby: C,

Java,JavaScript, and all languages that use IEEE-754 floating-point numbers suffer

from it as well.

 

相关知识

0.4
0.5×0.8=0.4被网友嘲讽,为什么你会怀疑自己甚至还拿计算器算?
温湿度对家畜的影响
如何做好火燕鸟饲料
烟台顽皮宠物用品销售有限公司
鸟类中的『女尊男卑』现象
实验动物的营养需要特点与饲养标准
宠物的快乐度是怎样减的?
一种宠物笼门的制作方法
养鸟安利闲谈

网址: 0.4 https://m.mcbbbk.com/newsview535370.html

所属分类:萌宠日常
上一篇: 宠物小精灵手游常见问题都有哪些?
下一篇: 运维必存的20个常见的故障排查、