[New-bugs-announce] [issue27975] math.isnan(int) and math.isinf(int) should not raise OverflowError
Steven D'Aprano
report at bugs.python.org
Tue Sep 6 13:04:33 EDT 2016
New submission from Steven D'Aprano:
Currently, math.isnan(n) and math.isinf(n) for n an int may raise OverflowError if n is too big to convert to a float, e.g.:
py> math.isnan(10**10000)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OverflowError: int too large to convert to float
But this conversion is unnecessary. int does not support either INF or NAN, so there is no need to convert the value to float first. If the argument is an int, the result must be False.
The same applies to Fraction.
----------
messages: 274568
nosy: steven.daprano
priority: normal
severity: normal
status: open
title: math.isnan(int) and math.isinf(int) should not raise OverflowError
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27975>
_______________________________________
More information about the New-bugs-announce
mailing list