txt: ## cool.md
  ## Chunk 1 of 3
  class Cool
  
  Object that can be treated as both a string and number
  
  ```raku
  class Cool is Any { }
  ```
  
  `Cool`, also known as the **C**onvenient **OO** **L**oop, is a base class employed by a number of built-in classes whose instances can be meaningfully coerced to a string and a number. For example, an [`Array`](/type/Array) can be used in mathematical operations, where its numerical representation is the number of elements it contains. At the same time, it can be concatenated to a string, where its stringy representation is all of its elements [joined](/routine/join) by a space. Because [`Array`](/type/Array) is `Cool`, the appropriate coercion happens automatically.
  
  Methods in `Cool` coerce the invocant to a more specific type, and then call the same method on that type. For example both [`Int`](/type/Int) and [`Str`](/type/Str) inherit from `Cool`, and calling method `substr` on an [`Int`](/type/Int) converts the integer to [`Str`](/type/Str) first.
  
  ```raku
  123.substr(1, 1);   # '2', same as 123.Str.substr(1, 1)
  ```
  
  Several built-in types inherit from `Cool`. See the [Type Graph](#typegraphrelations) below for a snapshot.
  
  The following table summarizes the methods that `Cool` provides, and what type they coerce to:
  
  | method | coercion type |
  | --- | --- |
  | abs | Numeric |
  | conj | Numeric |
  | sqrt | Numeric |
  | sign | Real |
  | rand | Numeric |
  | sin | Numeric |
  | asin | Numeric |
  | cos | Numeric |
  | acos | Numeric |
  | tan | Numeric |
  | tanh | Numeric |
  | atan | Numeric |
  | atan2 | Numeric |
  | atanh | Numeric |
  | sec | Numeric |
  | asec | Numeric |
  | cosec | Numeric |
  | acosec | Numeric |
  | cotan | Numeric |
  | cotanh | Numeric |
  | acotan | Numeric |
  | sinh | Numeric |
  | asinh | Numeric |
  | cosh | Numeric |
  | acosh | Numeric |
  | sech | Numeric |
  | asech | Numeric |
  | cosech | Numeric |
  | acosech | Numeric |
  | acotanh | Numeric |
  | cis | Numeric |
  | log | Numeric |
  | exp | Numeric |
  | roots | Numeric |
  | log10 | Numeric |
  | log2 | Numeric |
  | unpolar | Numeric |
  | round | Numeric |
  | floor | Numeric |
  | ceiling | Numeric |
  | truncate | Numeric |
  | chr | Int |
  | ord | Str |
  | chars | Str |
  | fmt | Str |
  | uniname | Str |
  | uninames | Seq |
  | unival | Str |
  | univals | Str |
  | uniprop | Str |
  | unimatch | Str |
  | uc | Str |
  | lc | Str |
  | fc | Str |
  | tc | Str |
  | tclc | Str |
  | flip | Str |
  | trans | Str |
  | contains | Str |
  | index | Str |
  | rindex | Str |
  | ords | Str |
  | split | Str |
  | match | Str |
  | comb | Str |
  | subst | Str |
  | sprintf | Str |
  | printf | Str |
  | samecase | Str |
  | trim | Str |
  | trim-leading | Str |
  | trim-trailing | Str |
  | EVAL | Str |
  | chomp | Str |
  | chop | Str |
  | codes | Str |
  | Complex | Numeric |
  | FatRat | Numeric |
  | Int | Numeric |
  | Num | Numeric |
  | Rat | Numeric |
  | Real | Numeric |
  | UInt | Numeric |
  
  # [Methods](#class_Cool "go to top of document")[§](#Methods "direct link")
  
  ## [routine abs](#class_Cool "go to top of document")[§](#routine_abs "direct link")
  
  ```raku
  sub abs(Numeric() $x)
  method abs()
  ```
  
  Coerces the invocant (or in the sub form, the argument) to [`Numeric`](/type/Numeric) and returns the absolute value (that is, a non-negative number).
  
  ```raku
  say (-2).abs;       # OUTPUT: «2␤»
  say abs "6+8i";     # OUTPUT: «10␤»
  ```
  
  ## [method conj](#class_Cool "go to top of document")[§](#method_conj "direct link")
  
  ```raku
  method conj()
  ```
  
  Coerces the invocant to [`Numeric`](/type/Numeric) and returns the [`Complex`](/type/Complex) conjugate (that is, the number with the sign of the imaginary part negated).
  
  ```raku
  say (1+2i).conj;        # OUTPUT: «1-2i␤»
  ```
  
  ## [method EVAL](#class_Cool "go to top of document")[§](#method_EVAL "direct link")
  
  ```raku
  method EVAL(*%_)
  
  ```
  
  It calls the [subroutine form](/type/independent-routines#routine_EVAL) with the invocant as the first argument, `$code`, passing along named args, if any.
  
  ## [routine sqrt](#class_Cool "go to top of document")[§](#routine_sqrt "direct link")
  
  ```raku
  sub sqrt(Numeric(Cool) $x)
  method sqrt()
  ```
  
  Coerces the invocant to [`Numeric`](/type/Numeric) (or in the sub form, the argument) and returns the square root, that is, a number that, when multiplied with itself, produces the original number.
  
  ```raku
  say 4.sqrt;             # OUTPUT: «2␤»
  say sqrt(2);            # OUTPUT: «1.4142135623731␤»
  ```
  
  Returns `NaN` for negative arguments. As of 6.e language version (early implementation exists in Rakudo compiler 2023.02+), will return a [`Complex`](/type/Complex) value for negative arguments.
  
  ```raku
  say sqrt(-1);           # OUTPUT: «0+1i␤»
  ```
  
  ## [method sign](#class_Cool "go to top of document")[§](#method_sign "direct link")
  
  ```raku
  method sign()
  ```
  
  Coerces the invocant to [`Real`](/type/Real) and returns its sign, that is, 0 if the number is 0, 1 for positive and -1 for negative values.
  
  ```raku
  say 6.sign;             # OUTPUT: «1␤»
  say (-6).sign;          # OUTPUT: «-1␤»
  say "0".sign;           # OUTPUT: «0␤»
  ```
  
  ## [method rand](#class_Cool "go to top of document")[§](#method_rand "direct link")
  
  ```raku
  method rand()
  ```
  
  Coerces the invocant to [`Num`](/type/Num) and returns a pseudo-random value between zero and the number.
  
  ```raku
  say 1e5.rand;           # OUTPUT: «33128.495184283␤»
  ```
  
  ## [routine sin](#class_Cool "go to top of document")[§](#routine_sin "direct link")
  
  ```raku
  sub sin(Numeric(Cool))
  method sin()
  ```
  
  Coerces the invocant (or in the sub form, the argument) to [`Numeric`](/type/Numeric), interprets it as radians, returns its [sine](https://en.wikipedia.org/wiki/Sine).
  
  ```raku
  say sin(0);             # OUTPUT: «0␤»
  say sin(pi/4);          # OUTPUT: «0.707106781186547␤»
  say sin(pi/2);          # OUTPUT: «1␤»
  ```
  
  Note that Raku is no computer algebra system, so `sin(pi)` typically does not produce an exact 0, but rather a very small [`Num`](/type/Num).
  
  ## [routine asin](#class_Cool "go to top of document")[§](#routine_asin "direct link")
  
  ```raku
  sub asin(Numeric(Cool))
  method asin()
  ```
  
  Coerces the invocant (or in the sub form, the argument) to [`Numeric`](/type/Numeric), and returns its [arc-sine](https://en.wikipedia.org/wiki/Inverse_trigonometric_functions) in radians.
  
  ```raku
  say 0.1.asin;               # OUTPUT: «0.10016742116156␤»
  say asin(0.1);              # OUTPUT: «0.10016742116156␤»
  ```
  
  ## [routine cos](#class_Cool "go to top of document")[§](#routine_cos "direct link")
  
  ```raku
  sub cos(Numeric(Cool))
  method cos()
  ```
  
  Coerces the invocant (or in sub form, the argument) to [`Numeric`](/type/Numeric), interprets it as radians, returns its [cosine](https://en.wikipedia.org/wiki/Cosine).
  
  ```raku
  say 0.cos;                  # OUTPUT: «1␤»
  say pi.cos;                 # OUTPUT: «-1␤»
  say cos(pi/2);              # OUTPUT: «6.12323399573677e-17␤»
  ```
  
  ## [routine acos](#class_Cool "go to top of document")[§](#routine_acos "direct link")
  
  ```raku
  sub acos(Numeric(Cool))
  method acos()
  ```
  
  Coerces the invocant (or in sub form, the argument) to [`Numeric`](/type/Numeric), and returns its [arc-cosine](https://en.wikipedia.org/wiki/Inverse_trigonometric_functions) in radians.
  
  ```raku
  say 1.acos;                 # OUTPUT: «0␤»
  say acos(-1);               # OUTPUT: «3.14159265358979␤»
  ```
  
  ## [routine tan](#class_Cool "go to top of document")[§](#routine_tan "direct link")
  
  ```raku
  sub tan(Numeric(Cool))
  method tan()
  ```
  
  Coerces the invocant (or in sub form, the argument) to [`Numeric`](/type/Numeric), interprets it as radians, returns its [tangent](https://en.wikipedia.org/wiki/Tangent).
  
  ```raku
  say tan(3);                 # OUTPUT: «-0.142546543074278␤»
  say 3.tan;                  # OUTPUT: «-0.142546543074278␤»
  ```
  
  ## [routine atan](#class_Cool "go to top of document")[§](#routine_atan "direct link")
  
  ```raku
  sub atan(Numeric(Cool))
  method atan()
  ```
  
  Coerces the invocant (or in sub form, the argument) to [`Numeric`](/type/Numeric), and returns its [arc-tangent](https://en.wikipedia.org/wiki/Inverse_trigonometric_functions) in radians.
  
  ```raku
  say atan(3);                # OUTPUT: «1.24904577239825␤»
  say 3.atan;                 # OUTPUT: «1.24904577239825␤»
  ```
  
  ## [routine atan2](#class_Cool "go to top of document")[§](#routine_atan2 "direct link")
  
  ```raku
  sub atan2($y, $x = 1e0)
  method atan2($x = 1e0)
  ```
  
  The sub should usually be written with two arguments for clarity as it is seen in other languages and in mathematical texts, but the single-argument form is available; its result will always match that of [atan](/routine/atan).
  
  ```raku
  say atan2 3, 1;             # OUTPUT: «1.2490457723982544␤»
  say atan2 3;                # OUTPUT: «1.2490457723982544␤»
  say atan2 ⅔, ⅓;             # OUTPUT: «1.1071487177940904␤»
  ```
  
  The method coerces self and its single argument to [`Numeric`](/type/Numeric), using them to compute the two-argument [arc-tangent](https://en.wikipedia.org/wiki/Atan2) in radians.
  
  ```raku
  say 3.atan2;                # OUTPUT: «1.24904577239825␤»
  say ⅔.atan2(⅓);             # OUTPUT: «1.1071487177940904␤»
  ```
  
  The $x argument in either the method or the sub defaults to 1 so, in both single-argument cases, the function will return the angle θ in radians between the x-axis and a vector that goes from the origin to the point (3, 1).
  
  ## [routine sec](#class_Cool "go to top of document")[§](#routine_sec "direct link")
  
  ```raku
  sub sec(Numeric(Cool))
  method sec()
  ```
  
  Coerces the invocant (or in sub form, its argument) to [`Numeric`](/type/Numeric), interprets it as radians, returns its [secant](https://en.wikipedia.org/wiki/Trigonometric_functions#Reciprocal_functions), that is, the reciprocal of its cosine.
  
  ```raku
  say 45.sec;                 # OUTPUT: «1.90359440740442␤»
  say sec(45);                # OUTPUT: «1.90359440740442␤»
  ```
  
  ## [routine asec](#class_Cool "go to top of document")[§](#routine_asec "direct link")
  
  ```raku
  sub asec(Numeric(Cool))
  method asec()
  ```
  
  Coerces the invocant (or in sub form, its argument) to [`Numeric`](/type/Numeric), and returns its [arc-secant](https://en.wikipedia.org/wiki/Inverse_trigonometric_functions) in radians.
  
  ```raku
  say 1.asec;                 # OUTPUT: «0␤»
  say sqrt(2).asec;           # OUTPUT: «0.785398163397448␤»
  ```
  
  ## [routine cosec](#class_Cool "go to top of document")[§](#routine_cosec "direct link")
  
  ```raku
  sub cosec(Numeric(Cool))
  method cosec()
  ```
  
  Coerces the invocant (or in sub form, its argument) to [`Numeric`](/type/Numeric), interprets it as radians, returns its [cosecant](https://en.wikipedia.org/wiki/Trigonometric_functions#Reciprocal_functions), that is, the reciprocal of its sine.
  
  ```raku
  say 0.45.cosec;             # OUTPUT: «2.29903273150897␤»
  say cosec(0.45);            # OUTPUT: «2.29903273150897␤»
  ```
  
  ## [routine acosec](#class_Cool "go to top of document")[§](#routine_acosec "direct link")
  
  ```raku
  sub acosec(Numeric(Cool))
  method acosec()
  ```
  
  Coerces the invocant (or in sub form, its argument) to [`Numeric`](/type/Numeric), and returns its [arc-cosecant](https://en.wikipedia.org/wiki/Inverse_trigonometric_functions) in radians.
  
  ```raku
  say 45.acosec;              # OUTPUT: «0.0222240516182672␤»
  say acosec(45)              # OUTPUT: «0.0222240516182672␤»
  ```
  
  ## [routine cotan](#class_Cool "go to top of document")[§](#routine_cotan "direct link")
  
  ```raku
  sub cotan(Numeric(Cool))
  method cotan()
  ```
  
  Coerces the invocant (or in sub form, its argument) to [`Numeric`](/type/Numeric), interprets it as radians, returns its [cotangent](https://en.wikipedia.org/wiki/Trigonometric_functions#Reciprocal_functions), that is, the reciprocal of its tangent.
  
  ```raku
  say 45.cotan;               # OUTPUT: «0.617369623783555␤»
  say cotan(45);              # OUTPUT: «0.617369623783555␤»
  ```
  
  ## [routine acotan](#class_Cool "go to top of document")[§](#routine_acotan "direct link")
  
  ```raku
  sub acotan(Numeric(Cool))
  method acotan()
  ```
  
  Coerces the invocant (or in sub form, its argument) to [`Numeric`](/type/Numeric), and returns its [arc-cotangent](https://en.wikipedia.org/wiki/Inverse_trigonometric_functions) in radians.
  
  ```raku
  say 45.acotan;              # OUTPUT: «0.0222185653267191␤»
  say acotan(45)              # OUTPUT: «0.0222185653267191␤»
  ```
  
  ## [routine sinh](#class_Cool "go to top of document")[§](#routine_sinh "direct link")
  
  ```raku
  sub sinh(Numeric(Cool))
  method sinh()
  ```
  
  Coerces the invocant (or in method form, its argument) to [`Numeric`](/type/Numeric), and returns its [Sine hyperbolicus](https://en.wikipedia.org/wiki/Hyperbolic_function).
  
  ```raku
  say 1.sinh;                 # OUTPUT: «1.1752011936438␤»
  say sinh(1);                # OUTPUT: «1.1752011936438␤»
  ```
  
  ## [routine asinh](#class_Cool "go to top of document")[§](#routine_asinh "direct link")
  
  ```raku
  sub asinh(Numeric(Cool))
  method asinh()
  ```
  
  Coerces the invocant (or in sub form, its argument) to [`Numeric`](/type/Numeric), and returns its [Inverse Sine hyperbolicus](https://en.wikipedia.org/wiki/Inverse_hyperbolic_function).
  
  ```raku
  say 1.asinh;                # OUTPUT: «0.881373587019543␤»
  say asinh(1);               # OUTPUT: «0.881373587019543␤»
  ```
  
  ## [routine cosh](#class_Cool "go to top of document")[§](#routine_cosh "direct link")
  
  ```raku
  sub cosh(Numeric(Cool))
  method cosh()
  ```
  
  Coerces the invocant (or in sub form, its argument) to [`Numeric`](/type/Numeric), and returns its [Cosine hyperbolicus](https://en.wikipedia.org/wiki/Hyperbolic_function).
  
  ```raku
  say cosh(0.5);              # OUTPUT: «1.12762596520638␤»
  ```
  
  ## [routine acosh](#class_Cool "go to top of document")[§](#routine_acosh "direct link")
  
  ```raku
  sub acosh(Numeric(Cool))
  method acosh()
  ```
  
  Coerces the invocant (or in sub form, its argument) to [`Numeric`](/type/Numeric), and returns its [Inverse Cosine hyperbolicus](https://en.wikipedia.org/wiki/Inverse_hyperbolic_function).
  
  ```raku
  say acosh(45);              # OUTPUT: «4.4996861906715␤»
  ```
  
  ## [routine tanh](#class_Cool "go to top of document")[§](#routine_tanh "direct link")
  
  ```raku
  sub tanh(Numeric(Cool))
  method tanh()
  ```
  
  Coerces the invocant (or in sub form, its argument) to [`Numeric`](/type/Numeric), interprets it as radians and returns its [Tangent hyperbolicus](https://en.wikipedia.org/wiki/Hyperbolic_function).
  
  ```raku
  say tanh(0.5);              # OUTPUT: «0.46211715726001␤»
  say tanh(atanh(0.5));       # OUTPUT: «0.5␤»
  ```
  
  ## [routine atanh](#class_Cool "go to top of document")[§](#routine_atanh "direct link")
  
  ```raku
  sub atanh(Numeric(Cool))
  method atanh()
  ```
  
  Coerces the invocant (or in sub form, its argument) to [`Numeric`](/type/Numeric), and returns its [Inverse tangent hyperbolicus](https://en.wikipedia.org/wiki/Inverse_hyperbolic_function).
  
  ```raku
  say atanh(0.5);             # OUTPUT: «0.549306144334055␤»
  ```
  
  ## [routine sech](#class_Cool "go to top of document")[§](#routine_sech "direct link")
  
  ```raku
  sub sech(Numeric(Cool))
  method sech()
  ```
  
  Coerces the invocant (or in sub form, its argument) to [`Numeric`](/type/Numeric), and returns its [Secant hyperbolicus](https://en.wikipedia.org/wiki/Hyperbolic_function).
  
  ```raku
  say 0.sech;                 # OUTPUT: «1␤»
  ```
  
  ## [routine asech](#class_Cool "go to top of document")[§](#routine_asech "direct link")
  
  ```raku
  sub asech(Numeric(Cool))
  method asech()
  ```
  
  Coerces the invocant (or in sub form, its argument) to [`Numeric`](/type/Numeric), and returns its [Inverse hyperbolic secant](https://en.wikipedia.org/wiki/Hyperbolic_function).
  
  ```raku
  say 0.8.asech;              # OUTPUT: «0.693147180559945␤»
  ```
  
  ## [routine cosech](#class_Cool "go to top of document")[§](#routine_cosech "direct link")
  
  ```raku
  sub cosech(Numeric(Cool))
  method cosech()
  ```
  
  Coerces the invocant (or in sub form, its argument) to [`Numeric`](/type/Numeric), and returns its [Hyperbolic cosecant](https://en.wikipedia.org/wiki/Hyperbolic_function).
  
  ```raku
  say cosech(pi/2);           # OUTPUT: «0.434537208094696␤»
  ```
  
  ## [routine acosech](#class_Cool "go to top of document")[§](#routine_acosech "direct link")
  
  ```raku
  sub acosech(Numeric(Cool))
  method acosech()
  ```
  
  Coerces the invocant (or in sub form, its argument) to [`Numeric`](/type/Numeric), and returns its [Inverse hyperbolic cosecant](https://en.wikipedia.org/wiki/Inverse_hyperbolic_function).
  
  ```raku
  say acosech(4.5);           # OUTPUT: «0.220432720979802␤»
  ```
  
  ## [routine cotanh](#class_Cool "go to top of document")[§](#routine_cotanh "direct link")
  
  ```raku
  sub cotanh(Numeric(Cool))
  method cotanh()
  ```
  
  Coerces the invocant (or in sub form, its argument) to [`Numeric`](/type/Numeric), and returns its [Hyperbolic cotangent](https://en.wikipedia.org/wiki/Hyperbolic_function).
  
  ```raku
  say cotanh(pi);             # OUTPUT: «1.00374187319732␤»
  ```
  
  ## [routine acotanh](#class_Cool "go to top of document")[§](#routine_acotanh "direct link")
  
  ```raku
  sub acotanh(Numeric(Cool))
  method acotanh()
  ```
  
  Coerces the invocant (or in sub form, its argument) to [`Numeric`](/type/Numeric), and returns its [Inverse hyperbolic cotangent](https://en.wikipedia.org/wiki/Inverse_hyperbolic_function).
  
  ```raku
  say acotanh(2.5);           # OUTPUT: «0.423648930193602␤»
  ```
  
  ## [routine cis](#class_Cool "go to top of document")[§](#routine_cis "direct link")
  
  ```raku
  sub cis(Numeric(Cool))
  method cis()
  ```
  
  Coerces the invocant (or in sub form, its argument) to [`Numeric`](/type/Numeric), and returns [cos(argument) + i\*sin(argument)](https://en.wikipedia.org/wiki/Cis_%28mathematics%29).
  
  ```raku
  say cis(pi/4);              # OUTPUT: «0.707106781186548+0.707106781186547i␤»
  ```
  
  ## [routine log](#class_Cool "go to top of document")[§](#routine_log "direct link")
  
  ```raku
  multi        log(Numeric(Cool) $number, Numeric(Cool) $base?)
  multi method log(Cool:D: Cool:D $base?)
  ```
  
  Coerces the arguments (including the invocant in the method form) to [`Numeric`](/type/Numeric), and returns its [Logarithm](https://en.wikipedia.org/wiki/Logarithm) to base `$base`, or to base `e` (Euler's Number) if no base was supplied ([Natural logarithm](https://en.wikipedia.org/wiki/Natural_logarithm)). Throws an exception if `$base` is `1`.
  
  ```raku
  say (e*e).log;              # OUTPUT: «2␤»
  ```
  
  Returns `NaN` for negative arguments. As of 6.e language version (early implementation exists in Rakudo compiler 2023.02+), will return a [`Complex`](/type/Complex) value for negative arguments.
  
  ## [routine log10](#class_Cool "go to top of document")[§](#routine_log10 "direct link")
  
  ```raku
  multi method log10()
  multi        log10(Numeric $x)
  multi        log10(Cool    $x)
  ```
  
  Coerces the invocant (or in the sub form, the argument) to [`Numeric`](/type/Numeric) (or uses it directly if it's already in that form), and returns its [Logarithm](https://en.wikipedia.org/wiki/Logarithm) in base 10, that is, a number that approximately produces the original number when 10 is raised to its power. Returns `-Inf` for `0`.
  
  ```raku
  say log10(1001);            # OUTPUT: «3.00043407747932␤»
  ```
  
  Returns `NaN` for negative arguments. As of 6.e language version (early implementation exists in Rakudo compiler 2023.02+), will return a [`Complex`](/type/Complex) value for negative arguments.
  
  ## [routine log2](#class_Cool "go to top of document")[§](#routine_log2 "direct link")
  
  ```raku
  multi method log2()
  multi        log2(Numeric $x)
  multi        log2(Cool    $x)
  ```
  
  Coerces the invocant to [`Numeric`](/type/Numeric), and returns its [Logarithm](https://en.wikipedia.org/wiki/Logarithm) in base 2, that is, a number that approximately (due to computer precision limitations) produces the original number when 2 is raised to its power. Returns `-Inf` for `0`.
  
  ```raku
  say log2(5);            # OUTPUT: «2.321928094887362␤»
  say "4".log2;           # OUTPUT: «2␤»
  say 4.log2;             # OUTPUT: «2␤»
  ```
  
  Returns `NaN` for negative arguments. As of 6.e language version (early implementation exists in Rakudo compiler 2023.02+), will return a [`Complex`](/type/Complex) value for negative arguments.
  
  ## [routine exp](#class_Cool "go to top of document")[§](#routine_exp "direct link")
  
  ```raku
  multi        exp(Cool:D $pow, Cool:D $base?)
  multi method exp(Cool:D: Cool:D $base?)
  ```
  
  Coerces the arguments (including the invocant in the method from) to [`Numeric`](/type/Numeric), and returns `$base` raised to the power of the first number. If no `$base` is supplied, `e` (Euler's Number) is used.
  
  ```raku
  say 0.exp;      # OUTPUT: «1␤»
  say 1.exp;      # OUTPUT: «2.71828182845905␤»
  say 10.exp;     # OUTPUT: «22026.4657948067␤»
  ```
  
  ## [method unpolar](#class_Cool "go to top of document")[§](#method_unpolar "direct link")
  
  ```raku
  method unpolar(Numeric(Cool))
  ```
  
  Coerces the arguments (including the invocant in the method form) to [`Numeric`](/type/Numeric), and returns a complex number from the given polar coordinates. The invocant (or the first argument in sub form) is the magnitude while the argument (i.e. the second argument in sub form) is the angle. The angle is assumed to be in radians.
  
  ```raku
  say sqrt(2).unpolar(pi/4);      # OUTPUT: «1+1i␤»
  ```
  
  ## [routine round](#class_Cool "go to top of document")[§](#routine_round "direct link")
  
  ```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␤»
  ```
  
  ## [routine floor](#class_Cool "go to top of document")[§](#routine_floor "direct link")
  
  ```raku
  multi        floor(Numeric(Cool))
  multi method floor
  ```
  
  Coerces the invocant (or in sub form, its argument) to [`Numeric`](/type/Numeric), and rounds it downwards to the nearest integer.
  
  ```raku
  say "1.99".floor;       # OUTPUT: «1␤»
  say "-1.9".floor;       # OUTPUT: «-2␤»
  say 0.floor;            # OUTPUT: «0␤»
  ```
  
  ## [method fmt](#class_Cool "go to top of document")[§](#method_fmt "direct link")
  
  ```raku
  method fmt($format = '%s')
  ```
  
  Uses `$format` to return a formatted representation of the invocant; equivalent to calling [sprintf](/routine/sprintf) with `$format` as format and the invocant as the second argument. The `$format` will be coerced to [`Stringy`](/type/Stringy) and defaults to `'%s'`.
  
  For more information about formats strings, see [sprintf](/routine/sprintf).
  
  ```raku
  say 11.fmt('This Int equals %03d');         # OUTPUT: «This Int equals 011␤»
  say '16'.fmt('Hexadecimal %x');             # OUTPUT: «Hexadecimal 10␤»
  ```
  
  ## [routine ceiling](#class_Cool "go to top of document")[§](#routine_ceiling "direct link")
  
  ```raku
  multi        ceiling(Numeric(Cool))
  multi method ceiling
  ```
  
  Coerces the invocant (or in sub form, its argument) to [`Numeric`](/type/Numeric), and rounds it upwards to the nearest integer.
  
  ```raku
  say "1".ceiling;        # OUTPUT: «1␤»
  say "-0.9".ceiling;     # OUTPUT: «0␤»
  say "42.1".ceiling;     # OUTPUT: «43␤»
  ```
  
  ## [routine truncate](#class_Cool "go to top of document")[§](#routine_truncate "direct link")
  
  ```raku
  multi        truncate(Numeric(Cool))
  multi method truncate()
  ```
  
  Coerces the invocant (or in sub form, its argument) to [`Numeric`](/type/Numeric), and rounds it towards zero.
  
  ```raku
  say 1.2.truncate;       # OUTPUT: «1␤»
  say truncate -1.2;      # OUTPUT: «-1␤»
  ```
  
  ## [routine ord](#class_Cool "go to top of document")[§](#routine_ord "direct link")
  
  ```raku
  sub ord(Str(Cool))
  method ord()
  ```
  
  Coerces the invocant (or in sub form, its argument) to [`Str`](/type/Str), and returns the [Unicode code point](https://en.wikipedia.org/wiki/Code_point) number of the first code point.
  
  ```raku
  say 'a'.ord;            # OUTPUT: «97␤»
  ```
  
  The inverse operation is [chr](/routine/chr).
  
  