在Python分数模块中,为什么round()的结果有时不正确?

-1 投票
0 回答
18 浏览
提问于 2025-04-11 23:35

用 round(fractions.Fraction("3.50")) 这个代码,你会得到 4,跟你预期的一样。但是用 round(fractions.Fraction("49886.50")) 这个代码,你却得到 49886,而不是 49887。这是怎么回事呢?

0 个回答

暂无回答

撰写回答