【发布时间】:2018-05-08 02:12:42
【问题描述】:
我目前在 Windows 7 中使用 Python 3.6。
当我将指数运算符 (**) 与给出大数字的浮点数一起使用时,我得到了一个意外的输出。
例如,“10^32”的输出是不同的,无论指数是整数 (32) 还是浮点数 (32.0)。
>>>print (int(10**(32.0)))
100000000000000005366162204393472
>>>print (int(10**(32)))
100000000000000000000000000000000
Using "**"operator in Python(example)
输出不同有什么原因吗?
如果是这样,我该如何解决这个问题?
【问题讨论】:
-
同样出现在
python 3.3/centos-6...猜它与操作系统无关! :) -
感谢您的链接!看来问题比我预想的要复杂:(
标签: python python-3.x exponentiation