Documentation

math.log2() function

math.log2() is a function returns the binary logarithm of x.

Function type signature
(x: float) => float
For more information, see Function type signatures.

Parameters

x

(Required) the value used in the operation.

Examples

Return the binary logarithm of a value

import "math"

math.log2(x: 3.14)// 1.6507645591169022

Use math.log2 in map

import "sampledata"
import "math"

sampledata.float()
    |> map(fn: (r) => ({r with _value: math.log2(x: r._value)}))

View example input and ouput


Was this page helpful?

Thank you for your feedback!


Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.