☰
fraction
fraction
§fraction(B type :integer fraction.B, num B, den B) => fraction fraction.B:numeric fraction fraction.B
§fraction(B
type
:integer fraction.B, num B, den B) =>
fraction fraction.B:
numeric fraction fraction.Bjust for brevity
reduce numerator and denominator by their gcd:
fraction provides fraction numbers based on an integer type to represent the
numerator and the denominator.
basic numeric operations +, -, * and comparison are supported. numerator and
denominator are reduced after each operation.
there are currently no checks or preconditions for overflows in the numerator
or the denominator.