小编Gor*_*Jun的帖子

分区// vs int()四舍五入

我是Python 3.6.0的新用户.我试图划分2个产生大量输出的数字.但是,使用

return ans1 // ans2
Run Code Online (Sandbox Code Playgroud)

使用时产生55347740058143507128

return int(ans1 / ans2)
Run Code Online (Sandbox Code Playgroud)

生产55347740058143506432.

哪个更准确,为什么会这样?

python floating-point int rounding floor-division

2
推荐指数
1
解决办法
93
查看次数

标签 统计

floating-point ×1

floor-division ×1

int ×1

python ×1

rounding ×1