Stefan Pochmann writes:
 > Mark Dickinson wrote:
 > > Unrelated question: under this proposal, what would you want
 > > `Fraction(10**400) / 1e200` to do?

 > Btw the full error message I get for that is "OverflowError:
 > integer division result too large for a float". Even for
 > `Fraction(10**400, 3) / 3.14`. Saying "integer division" when
 > neither operand is an integer and I'm also not using `//` feels
 > suboptimal.

In converting Fraction(m, n) to float, presumably you just do m / n, no?

>>> float(Fraction(10**400, 10**399))
10.0
>>> float(Fraction(10**400, 3))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File 
"/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/numbers.py",
 line 291, in __float__
    return self.numerator / self.denominator
OverflowError: integer division result too large for a float

Seems reasonable to me.



_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/OJ3TF7Z4XX7SA2AOVOX4ALEIW2SZBPC7/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to