首页 > 解决方案 > 大数的python除法自动上限

问题描述

Python 3.7.4 (tags/v3.7.4:e09359112e, Jul  8 2019, 19:29:22) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> print(111111111111111111/10)
1.1111111111111112e+16
>>> print(int(111111111111111111/10))
11111111111111112
>>>

参考上面的片段,有人可以帮我理解为什么111111111111111111/10返回11111111111111112而不是11111111111111111

标签: pythondivision

解决方案


使用楼层划分

>>> 111111111111111111//10
11111111111111111
>>> 

推荐阅读