【Python报错】ComplexWarning: Casting complex values to real discards the imaginary part

前端之家收集整理的这篇文章主要介绍了【Python报错】ComplexWarning: Casting complex values to real discards the imaginary part前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

运行代码

报错:

ComplexWarning: Casting complex values to real discards the imaginary part

(将复数转换为实数丢弃虚部)

原因:

a是int32,能表示的最大数是2**32-1,而10**10显然超出这个范围;


原文地址:

https://stackoverflow.com/questions/7559595/python-runtimewarning-overflow-encountered-in-long-scalars

猜你在找的Python相关文章