请考虑以下代码:
0.1 + 0.2 == 0.3 -> false
0.1 + 0.2 -> 0.30000000000000004
为什么会出现这些不准确之处?
language-agnostic math floating-point floating-accuracy
在C#中,结果Math.Round(2.5)为2.
Math.Round(2.5)
应该是3,不是吗?为什么它是2而不是C#?
.net rounding
.net ×1
floating-accuracy ×1
floating-point ×1
language-agnostic ×1
math ×1
rounding ×1