Python3.4舍入到最近的偶数(在打破平局情况下).
>>> round(1.5)
2
>>> round(2.5)
2
Run Code Online (Sandbox Code Playgroud)
但是当四舍五入到整数时,它似乎只是这样做.
>>> round(2.75, 1)
2.8
>>> round(2.85, 1)
2.9
Run Code Online (Sandbox Code Playgroud)
在上面的最后一个例子中,当圆整到最接近的偶数时,我会预期2.8作为答案.
为什么两种行为之间存在差异?