MCPcopy Index your code
hub / github.com/python/cpython / _mul

Method _mul

Lib/fractions.py:826–838  ·  view source on GitHub ↗

a * b

(a, b)

Source from the content-addressed store, hash-verified

824 __sub__, __rsub__ = _operator_fallbacks(_sub, operator.sub)
825
826 def _mul(a, b):
827 """a * b"""
828 na, da = a._numerator, a._denominator
829 nb, db = b._numerator, b._denominator
830 g1 = math.gcd(na, db)
831 if g1 > 1:
832 na //= g1
833 db //= g1
834 g2 = math.gcd(nb, da)
835 if g2 > 1:
836 nb //= g2
837 da //= g2
838 return Fraction._from_coprime_ints(na * nb, db * da)
839
840 __mul__, __rmul__ = _operator_fallbacks(_mul, operator.mul)
841

Callers

nothing calls this directly

Calls 1

_from_coprime_intsMethod · 0.80

Tested by

no test coverage detected