mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
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:
parent
9b9394df5f
commit
8464b754c4
4 changed files with 36 additions and 4 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue