txt: ## round.md
  round
  
  Combined from primary sources listed below.
  
  # [In Complex](#___top "go to top of document")[§](#(Complex)_method_round "direct link")
  
  See primary documentation
  [in context](/type/Complex#method_round)
  for **method round**.
  
  ```raku
  multi method round(Complex:D: --> Complex:D)
  multi method round(Complex:D: Real() $scale --> Complex:D)
  ```
  
  With no arguments, rounds both the real and imaginary parts to the nearest integer and returns a new `Complex` number. If `$scale` is given, rounds both parts of the invocant to the nearest multiple of `$scale`. Uses the same algorithm as [Real.round](/type/Real#method_round) on each part of the number.
  
  ```raku
  say (1.2-3.8i).round;           # OUTPUT: «1-4i␤»
  say (1.256-3.875i).round(0.1);  # OUTPUT: «1.3-3.9i␤»
  ```
  
  # [In Cool](#___top "go to top of document")[§](#(Cool)_routine_round "direct link")
  
  See primary documentation
  [in context](/type/Cool#routine_round)
  for **routine round**.
  
  ```raku
  multi        round(Numeric(Cool), $scale = 1)
  multi method round(Cool:D: $scale = 1)
  ```
  
  Coerces the invocant (or in sub form, its argument) to [`Numeric`](/type/Numeric), and rounds it to the unit of `$scale`. If `$scale` is 1, rounds to the nearest integer; an arbitrary scale will result in the closest multiple of that number.
  
  ```raku
  say 1.7.round;          # OUTPUT: «2␤»
  say 1.07.round(0.1);    # OUTPUT: «1.1␤»
  say 21.round(10);       # OUTPUT: «20␤»
  say round(1000, 23.01)  # OUTPUT: «989.43␤»
  ```
  
  Always rounds **up** if the number is at mid-point:
  
  ```raku
  say (−.5 ).round;       # OUTPUT: «0␤»
  say ( .5 ).round;       # OUTPUT: «1␤»
  say (−.55).round(.1);   # OUTPUT: «-0.5␤»
  say ( .55).round(.1);   # OUTPUT: «0.6␤»
  ```
  
  **Pay attention** to types when using this method, as ending up with the wrong type may affect the precision you seek to achieve. For [`Real`](/type/Real) types, the type of the result is the type of the argument ([`Complex`](/type/Complex) argument gets coerced to [`Real`](/type/Real), ending up a [`Num`](/type/Num)). If rounding a [`Complex`](/type/Complex), the result is [`Complex`](/type/Complex) as well, regardless of the type of the argument.
  
  ```raku
  9930972392403501.round(1)      .raku.say; # OUTPUT: «9930972392403501␤»
  9930972392403501.round(1e0)    .raku.say; # OUTPUT: «9.9309723924035e+15␤»
  9930972392403501.round(1e0).Int.raku.say; # OUTPUT: «9930972392403500␤»
  ```
  
  # [In role Real](#___top "go to top of document")[§](#(role_Real)_method_round "direct link")
  
  See primary documentation
  [in context](/type/Real#method_round)
  for **method round**.
  
  ```raku
  method round(Real:D: $scale = 1)
  ```
  
  Rounds the number to scale `$scale`. If `$scale` is 1, rounds to an integer. If scale is `0.1`, rounds to one digit after the radix point (period or comma), etc.
  