Fuzion Logo
fuzion-lang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.

fraction

fraction

§fraction(B 
type
:integer fraction.B, num B, den B)
 => 
fraction fraction.B
:
numeric fraction fraction.B

fraction


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.
just for brevity

redefines:


redefines:


redefines:


redefines:


redefines:


redefines:

basic operations

redefines:


redefines:

reduce numerator and denominator by their gcd:
enable generic features in ancestors

redefines:


redefines: