DADiSP Worksheet Functions > Function Categories > Fourier Transforms and Signal Processing > LOG2

 

LOG2

Purpose:

Returns Log base 2 of the input.

Syntax:

LOG2(val)

(s, n) = LOG2(val)

val

-

A scalar, series or table.

Returns:

A real, series or table, log base 2 of the input.

 

(s, n) = LOG2(val) returns s and n such that val = s ∙ 2n and 1/2 ≤ |s| < 1.

Example:

log2(1024)

 

returns 10.

Example:

log2({2, 4, 8, 16})

 

returns the series {1, 2, 3, 4}.

Example:

(s, n) = log2(3)

 

s == 0.75

n == 2

 

s * 2^n == 3

Example:

W1: (s, n) = log2({1..5});ravel(s, n, s * 2^n)

 

W1 == {{0.5,   1.0, 1.0},

       {0.5,   2.0, 2.0},

       {0.75,  2.0, 3.0},

       {0.5,   3.0, 4.0},

       {0.625, 3.0, 5.0}}

Remarks:

LOG2 is useful for manipulating the lengths of FFT calculations.

See Also:

FFT

LOG

LOG10

LOG1P