In Cool§
See primary documentation in context for method FatRat
multi method FatRat()
Coerces the invocant to a Numeric
and calls its .FatRat
method. Fails if the coercion to a Numeric
cannot be done.
say 1+0i.FatRat; # OUTPUT: «1»say 2e1.FatRat; # OUTPUT: «20»say 1.3.FatRat; # OUTPUT: «1.3»say (-4/3).FatRat; # OUTPUT: «-1.333333»say "foo".FatRat.^name; # OUTPUT: «Failure»
In Num§
See primary documentation in context for method FatRat
method FatRat(Num: Real = 1e-6)
Converts the number to a FatRat
with the precision $epsilon
. If invocant is an Inf
, -Inf
, or NaN
, converts them to a FatRat
with 0
denominator and 1
, -1
, or 0
numerator, respectively.