在Python中尝试计算一个非常大的数字时,我遇到了错误。这是我的代码:
# Where fourthNumber = 2790
# and dee = 413
emm = math.pow(fourthNumber, dee)
我的错误是:
line 44, in <module>
emm = math.pow(fourthNumber, dee)
OverflowError: math range error
有没有办法解决这个错误?我以为Python可以处理任意大的数字,难道我错了吗?如果有帮助,将不胜感激。谢谢!
2790**413
可以工作...math.pow(..)
更适用于浮点数。 - Willem Van Onsem