In role Numeric§
See primary documentation in context for routine log
multi log(Numeric, Numeric = e --> Numeric)multi method log(Numeric: Numeric = e --> Numeric)
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.
In Cool§
See primary documentation in context for routine log
multi log(Numeric(Cool) , Numeric(Cool) ?)multi method log(Cool: Cool ?)
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.