routine log

Documentation for routine log assembled from the following types:

class Numeric

From Numeric

(Numeric) routine log

multi sub    log(Numeric:DNumeric $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. Returns NaN if $base is negative. Throws an exception if $base is 1.

class Cool

From Cool

(Cool) routine log

Defined as:

multi sub log(Numeric(Cool$numberNumeric(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). Returns NaN if $base is negative. Throws an exception if $base is 1.

say (e*e).log;              # OUTPUT: «2␤»