Rational number (arbitrary-precision)
is Cool does Rational[Int, Int]
FatRat is a rational number stored with arbitrary size numerator and denominator. Arithmetic operations involving a
FatRat and optionally Int or Rat objects return a
FatRat, avoiding loss of precision.
There are two common ways to generate
FatRat objects: through the
FatRat.new(Int, Int) constructor, which generates them from numerator and denominator, or by calling the
.FatRat method on an Int or Rat object.
multi method raku(FatRat: --> Str)
say FatRat.new(1, 2).raku; # OUTPUT: «FatRat.new(1, 2)␤»