summaryrefslogtreecommitdiffstats
path: root/Lib/numbers.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/numbers.py')
-rw-r--r--Lib/numbers.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/numbers.py b/Lib/numbers.py
index 6c3c3e1..4dd5ca7 100644
--- a/Lib/numbers.py
+++ b/Lib/numbers.py
@@ -291,7 +291,13 @@ class Rational(Real, Exact):
# Concrete implementation of Real's conversion to float.
def __float__(self):
- """float(self) = self.numerator / self.denominator"""
+ """float(self) = self.numerator / self.denominator
+
+ It's important that this conversion use the integer's "true"
+ division rather than casting one side to float before dividing
+ so that ratios of huge integers convert without overflowing.
+
+ """
return self.numerator / self.denominator