def Rational.cmp
import bend-kit-bignum@0.1.0.0/rational.bend as Rationalimport Base
import bend-kit-bignum@0.1.0.0/bigint.bend as Big
76# Denominators are positive, so cross-multiplying keeps the order.
77def Rational.cmp(a: Rational, b: Rational) -> Cmp:
78 match a b:
79 case Rational{an, ad} Rational{bn, bd}:
80 Big.BigInt.cmp(Big.BigInt.mul(an, bd), Big.BigInt.mul(bn, ad))
Uses (4)
Used by (0)
No other definition uses this definition.