相关疑难解决方法(0)

在什么情况下Python复数指数抛出一个OverflowError?

我试图找出这里的模式:

>>> 1e300 ** 2
OverflowError: (34, 'Result too large')
>>> 1e300j ** 2
OverflowError: complex exponentiation
>>> (1e300 + 1j) ** 2
OverflowError: complex exponentiation
>>> (1e300 + 1e300j) ** 2
(nan+nanj)
Run Code Online (Sandbox Code Playgroud)

这种行为似乎不仅在理论上没有说明,而且在实践中也很奇怪!这解释了什么?

python floating-point complex-numbers

4
推荐指数
1
解决办法
3239
查看次数

标签 统计

complex-numbers ×1

floating-point ×1

python ×1