method Rat

Documentation for method Rat assembled from the following types:

class Numeric

From Numeric

(Numeric) method Rat

method Rat(Numeric:D: Real $epsilon = 1.0e-6 --> Rat:D)

If this Numeric is equivalent to a Real, return a Rat which is within $epsilon of that Real's value. Fail with X::Numeric::Real otherwise.

class RatStr

From RatStr

(RatStr) method Rat

method Rat

Returns the Rat value of the RatStr.

class Str

From Str

(Str) method Rat

Defined as:

method Rat(Str:D: --> Rational:D)

Coerces the string to a Rat object, using the same rules as Str.Numeric. If the denominator is larger than 64-bits is it still kept and no degradation to Num occurs.

role Real

From Real

(Real) method Rat

method Rat(Real:D: Real $epsilon = 1e-6)

Converts the number to a Rat with the precision $epsilon.