txt: ## rat.md
  Rat
  
  Combined from primary sources listed below.
  
  # [In Num](#___top "go to top of document")[§](#(Num)_method_Rat "direct link")
  
  See primary documentation
  [in context](/type/Num#method_Rat)
  for **method Rat**.
  
  ```raku
  method Rat(Num:D: Real $epsilon = 1e-6)
  ```
  
  Converts the number to a [`Rat`](/type/Rat) with `$epsilon` precision. If the invocant is an `Inf`, `-Inf`, or `NaN`, converts them to a [`Rat`](/type/Rat) with `0` [denominator](/routine/denominator) and `1`, `-1`, or `0` [numerator](/routine/numerator), respectively.
  
  # [In RatStr](#___top "go to top of document")[§](#(RatStr)_method_Rat "direct link")
  
  See primary documentation
  [in context](/type/RatStr#method_Rat)
  for **method Rat**.
  
  ```raku
  method Rat
  ```
  
  Returns the [`Rat`](/type/Rat) value of the `RatStr`.
  
  # [In Str](#___top "go to top of document")[§](#(Str)_method_Rat "direct link")
  
  See primary documentation
  [in context](/type/Str#method_Rat)
  for **method Rat**.
  
  ```raku
  method Rat(Str:D: --> Rational:D)
  ```
  
  Coerces the string to a [`Rat`](/type/Rat) object, using the same rules as [`Str.Numeric`](/type/Str#method_Numeric). If the denominator is larger than 64-bits is it still kept and no degradation to [`Num`](/type/Num) occurs.
  
  # [In Cool](#___top "go to top of document")[§](#(Cool)_method_Rat "direct link")
  
  See primary documentation
  [in context](/type/Cool#method_Rat)
  for **method Rat**.
  
  ```raku
  multi method Rat()
  ```
  
  Coerces the invocant to a [`Numeric`](/type/Numeric) and calls its [`.Rat`](/routine/Rat) method. [Fails](/routine/fail) if the coercion to a [`Numeric`](/type/Numeric) cannot be done.
  
  ```raku
  say 1+0i.Rat;                             # OUTPUT: «1␤»
  say 2e1.Rat;                              # OUTPUT: «20␤»
  say (-4/3).Rat;                           # OUTPUT: «-1.333333␤»
  say "foo".Rat.^name;                      # OUTPUT: «Failure␤»
  say (.numerator, .denominator) for π.Rat; # OUTPUT: «(355 113)␤»
  ```
  
  # [In role Real](#___top "go to top of document")[§](#(role_Real)_method_Rat "direct link")
  
  See primary documentation
  [in context](/type/Real#method_Rat)
  for **method Rat**.
  
  ```raku
  method Rat(Real:D: Real $epsilon = 1e-6)
  ```
  
  Calls the [`Bridge` method](/routine/Bridge) on the invocant and then the [`Rat` method](/routine/Rat) on its return value with the `$epsilon` argument.
  