Is there any way to check if a long integer is too large to convert to a float in python?
>>> import sys
>>> sys.float_info.max
1.7976931348623157e+308
Actually, if you try to convert an integer too big to a float, an exception will be raised.
>>> 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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With