gh-68163: Correct conversion of Rational instances to float (GH-25619)

* gh-68163: Correct conversion of Rational instances to float

Also document that numerator/denominator properties are instances of Integral.

Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
This commit is contained in:
Sergey B Kirpichev 2022-09-04 15:15:59 +03:00 committed by GitHub
parent 9b9394df5f
commit 8464b754c4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 36 additions and 4 deletions

View file

@ -313,7 +313,7 @@ class Rational(Real):
so that ratios of huge integers convert without overflowing.
"""
return self.numerator / self.denominator
return int(self.numerator) / int(self.denominator)
class Integral(Rational):