ad1*_*126 5 python floating-point integer
有没有办法检查一个长整数是否太大,无法转换为python中的浮点数?
ken*_*ytm 13
>>> import sys
>>> sys.float_info.max
1.7976931348623157e+308
Run Code Online (Sandbox Code Playgroud)
实际上,如果您尝试将一个太大的整数转换为浮点数,则会引发异常.
>>> float(2 * 10**308)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OverflowError: Python int too large to convert to C double
Run Code Online (Sandbox Code Playgroud)