In Cool§

See primary documentation in context for routine log

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, and returns its Logarithm to base $base, or to base e (Euler's Number) if no base was supplied (Natural logarithm). Throws an exception if $base is 1.

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 value for negative arguments.

In role Numeric§

See primary documentation in context for routine log

multi        log(Numeric:D, Numeric $base = e --> Numeric:D)
multi method log(Numeric:D: Numeric $base = e --> Numeric:D)

Calculates the logarithm to base $base. Defaults to the natural logarithm. Throws an exception if $base is 1.

Returns NaN for negative arguments. As of 6.e language version (early implementation exists in Rakudo compiler 2023.02+), will return a Complex value for negative arguments.