可能重复:
Why is floating point arithmetic in C# imprecise?为什么0.1 * 10-1不等于0?
Console.WriteLine(0.5f * 2f); // 1
Console.WriteLine(0.5f * 2f - 1f); // 0
Console.WriteLine(0.1f * 10f); // 1
Console.WriteLine(0.1f * 10f - 1f); // 1.490116E-08
为什么0.1f * 10f - 1f
最终被1.490116E-08
(0.0000001490116
)?
参见:“为什么不能十进制数是用二进制表示吗?“](http://stackoverflow.com/questions/1089018/why-cant-decimal-numbers-be-represented-exactly-in-binary) – 2010-11-25 00:41:07