routine log2

Documentation for routine log2 assembled from the following types:

class Numeric

From Numeric

(Numeric) routine log2

multi sub    log2(Numeric:D)
multi method log2(Numeric:D:)

Calculates the logarithm to base 2. Returns NaN for negative arguments and -Inf for 0.

class Cool

From Cool

(Cool) routine log2

Defined as:

multi method log2()

Coerces the invocant to Numeric, and returns its Logarithm to base 2, that is, a number that approximately produces the original number when raised to the power of 2. Returns NaN for negative arguments and -Inf for 0.

say log2(5);            # OUTPUT: «2.321928094887362␤» 
say "4".log2;           # OUTPUT: «2␤»