Table of Contents
numbers
math
cmath
decimal
fractions
fractions.Decimal
fractions.Fraction
fractions.Rational
random
itertools
functools
operator
Rational.
__float__
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.