Message193783
When the integer division result is too large to converto to float, and the operands are inside the limits, the result is `inf` or `-inf`::
>>> 2**1023 / 2**-3
inf
>>> 2**1022 / 2**-4
inf
>>> 2**1023 / 2**-1074
inf
When both the result and an operand are too large to converto to float, we raise an OverflowError::
>>> 2**1028 / 2**-2
Traceback (most recent call last):
File "<input>", line 1, in <module>
OverflowError: long int too large to convert to float
The message says: "long int too large to convert to float". I think in Python 3 it should be "int too large to convert...". In any case, the most important thing is that in the same situation we get a different message [1]_::
>>> 2**1032 / 2**2
Traceback (most recent call last):
File "<input>", line 1, in <module>
OverflowError: integer division result too large for a float
and I think is it muddleheaded, because it should be "long int too large to convert to float", as we got in the case `2**1028 / 2**-2`. I think we should never show "integer division result too large for a float", but just:
* `inf` or `-inf` when the operands are inside the limits, but the result
does not
* `OverflowError: long int too large to convert to float` when the result,
and at least one operand, are out of range.
.. [1] In this situation, we get the message "OverflowError: integer division result too large for a float" only when the denominator exponent is positive. |
|
Date |
User |
Action |
Args |
2013-07-27 11:31:25 | marco.buttu | set | recipients:
+ marco.buttu |
2013-07-27 11:31:25 | marco.buttu | set | messageid: <1374924685.41.0.945479313268.issue18570@psf.upfronthosting.co.za> |
2013-07-27 11:31:25 | marco.buttu | link | issue18570 messages |
2013-07-27 11:31:25 | marco.buttu | create | |
|