问题描述
在我的程序中,我试图做一个5.1 * 100的简单计算,如果我的成绩学校水平数学是正确的,那么
应该= 510。我的问题是vb.net
返回509.99999999999994作为答案。我做错了什么?
在.Net IDE的命令窗口中自行尝试。
在调试过程中在命令窗口输入?5.1 * 100。 />
谢谢,
Chris Baxter
< http://research.microsoft.com/~hollasch/cgindex/coding/ieeefloat.html>
-
Herfried K. Wagner
MVP·VB Classic,VB.NET
< http://www.mvps.org/dotnet>
In my program I am trying to do a simple calculation of 5.1 * 100 which
should =510 if my gradeschool level math is correct. My problem is vb.net
is returning 509.99999999999994 as the answer. Am I doing something wrong?
Try it for yourself in your Command Window in the .Net IDE.
Type ?5.1 * 100 in the command window during debugging.
Thanks,
Chris Baxter
cb*****@pilotair.com
<http://research.microsoft.com/~hollasch/cgindex/coding/ieeefloat.html>
--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
这篇关于简单数学中的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!