python - 溢出错误 : math range error

标签 python math

>>> import math
>>> math.pow(2, 3000)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OverflowError: math range error

我该如何解决?

最佳答案

使用内置运算符。

2**3000

关于python - 溢出错误 : math range error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2988634/

相关文章:

c - 在c中使用sin函数得到错误的值

r - 寻找合理范围

algorithm - 使用置换矩阵对稀疏矩阵进行 Cholesky 分解

python - 从 R 或 Python 中的字符串中提取

python - 在 Python 中获取大文件的 MD5 哈希

python - 使用 lxml 解析 xml 文件

python - 如何在 python 中使用 c 结构?

python - 计算存房押金所需月数的函数

algorithm - 找到一个范围内总和的子集

python - Python 中的分层 K 折叠