为什么 System::Convert 有如此奇怪的舍入定义行为?

Why does System::Convert have such strange defined behaviour for rounding?

我正在查看 MSDN documentation for System::Convert::ToUInt32(Double),return 的值是 "value rounded to the nearest 32-bit unsigned integer. If value is halfway between two whole numbers, the even number is returned; that is, 4.5 is converted to 4, and 5.5 is converted to 6." 这似乎是一种非常奇怪的舍入数字的方法,实际上似乎使函数不适合大多数我想使用它的情况。有什么理由应该这样吗?

这个问题似乎与 C++ 编程语言无关(尽管有标签),但与 C# 有关。

这是up-to-date official documentation for Convert.Uint32(double), 实现了通常称为 "round half to even" 或 "bankers rounding" 的内容,请参阅 wikipedia 上的参考资料。

IEEE 754 标准 (wikipedia reference here) 描述了浮点数(例如双精度)的舍入规则。微软只是遵循了这些规则。

作为补充,"bankers rounding" 不像 "round half away from zero" 方法那样受到负或正偏差的影响,至少在大多数合理的分布中是这样。因此它被认为是一种 "better" 舍入方法。