Reference to the log2() function

Summary

log2(<tsExpression>)

Returns the logarithm base 2 of each data value described by the expression.

Parameters

ParameterDescription
tsExpression Expression describing a constant or a time series of values to take the logarithm of.

Description

The log2() function produces a time series in which each data value is equal to the binary logarithm (log base 2) of the value or values specified by the expression. The binary logarithm is the power to which you need to raise 2 to obtain the value of the expression.

  • If tsExpression describes a constant value N, then log2() returns a continuous series where every data value is log2 N.
  • If tsExpression describes one or more time series, then log2() returns a new time series for each input time series. Each value in a new time series is calculated as log2 V, where V is the value of the corresponding point in the input time series.

By default, the chart legend displays a rounded version of the result. You can cause the legend to display the result with more precision by holding down the shift key when you hover over the time series.

Examples

Here we see the result (in orange) of using log2() to take the binary log of a time series (in purple).

ts log2 ts

See also