Imports name this capability’s declared dependencies, which fune builds next to it in your project; each one links to its page.
from .math_rational_rational import rational_from_wide, rational_parts ← rational, another function of this group · built into the same file, even by a slim install
from .math_rational_types import Rational
def add_rational(a: Rational, b: Rational) -> Rational:
"""a + b, reduced."""
an, ad = rational_parts(a)
bn, bd = rational_parts(b)
return rational_from_wide(an * bd + bn * ad, ad * bd)