txt: ## num.md
  Num
  
  Combined from primary sources listed below.
  
  # [In role Rational](#___top "go to top of document")[§](#(role_Rational)_method_Num "direct link")
  
  See primary documentation
  [in context](/type/Rational#method_Num)
  for **method Num**.
  
  ```raku
  method Num(Rational:D: --> Num:D)
  ```
  
  Coerces the invocant to [`Num`](/type/Num) by dividing [numerator](/routine/numerator) by [denominator](/routine/denominator). If [denominator](/routine/denominator) is `0`, returns `Inf`, `-Inf`, or `NaN`, based on whether [numerator](/routine/numerator) is a positive number, negative number, or `0`, respectively.
  
  # [In Num](#___top "go to top of document")[§](#(Num)_method_Num "direct link")
  
  See primary documentation
  [in context](/type/Num#method_Num)
  for **method Num**.
  
  ```raku
  method Num()
  ```
  
  Returns the invocant.
  
  # [In Str](#___top "go to top of document")[§](#(Str)_method_Num "direct link")
  
  See primary documentation
  [in context](/type/Str#method_Num)
  for **method Num**.
  
  ```raku
  method Num(Str:D: --> Num:D)
  ```
  
  Coerces the string to [`Num`](/type/Num), using the same rules as [`Str.Numeric`](/type/Str#method_Numeric) and handling negative zero, `-0e0`, and positive zero, `0e0`.
  
  ```raku
  my Str $s = "-0/5";
  say (.self, .^name) given $s.Numeric;  # OUTPUT: «(0 Rat)␤»
  say (.self, .^name) given $s.Num;      # OUTPUT: «(-0 Num)␤»
  
  ```
  
  # [In NumStr](#___top "go to top of document")[§](#(NumStr)_method_Num "direct link")
  
  See primary documentation
  [in context](/type/NumStr#method_Num)
  for **method Num**.
  
  ```raku
  method Num
  ```
  
  Returns the [`Num`](/type/Num) value of the `NumStr`.
  
  # [In Cool](#___top "go to top of document")[§](#(Cool)_method_Num "direct link")
  
  See primary documentation
  [in context](/type/Cool#method_Num)
  for **method Num**.
  
  ```raku
  multi method Num()
  ```
  
  Coerces the invocant to a [`Numeric`](/type/Numeric) and calls its [`.Num`](/routine/Num) method. [Fails](/routine/fail) if the coercion to a [`Numeric`](/type/Numeric) cannot be done.
  
  ```raku
  say 1+0i.Num;             # OUTPUT: «1␤»
  say 2e1.Num;              # OUTPUT: «20␤»
  say (16/9)².Num;          # OUTPUT: «3.1604938271604937␤»
  say (-4/3).Num;           # OUTPUT: «-1.3333333333333333␤»
  say "foo".Num.^name;      # OUTPUT: «Failure␤»
  ```
  
  # [In role Real](#___top "go to top of document")[§](#(role_Real)_method_Num "direct link")
  
  See primary documentation
  [in context](/type/Real#method_Num)
  for **method Num**.
  
  ```raku
  method Num(Real:D:)
  ```
  
  Calls the [`Bridge` method](/routine/Bridge) on the invocant and then the [`Num` method](/routine/Num) on its return value.
  