标签: vb.net visual-studio-2012
做一个简单的减法,例如:
Dim a, b As Double a = 81.4 b = 76.0 MsgBox(a - b)
你会期望它会产生5.4但是你获得5.4000000000000001 发生了什么事?
答案 0 :(得分:2)
浮点数,即使是双精度浮点数,也不是具有无限精度的“实数”。
请参阅What Every Computer Scientist Should Know About Floating-Point Arithmetic
Bruce Dawson's blog
Wikipedia