This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author marco.buttu
Recipients marco.buttu
Date 2013-07-27.11:31:25
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1374924685.41.0.945479313268.issue18570@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2013-07-27 11:31:25marco.buttusetrecipients: + marco.buttu
2013-07-27 11:31:25marco.buttusetmessageid: <1374924685.41.0.945479313268.issue18570@psf.upfronthosting.co.za>
2013-07-27 11:31:25marco.buttulinkissue18570 messages
2013-07-27 11:31:25marco.buttucreate