Skip to content

log2 - Calculate log to base 2

log2 is a shorthand for computing log(2, number). It calculates the log, to base 2, for a given value.

Syntax

Like many functions in DataPrime, log2 supports two notations, function and method notation. These interchangeable forms allow flexibility in how you structure expressions.

log2(number: number): number
number: number.log2(): number

Arguments

NameTypeRequiredDescription
numbernumbertrueThe value whose logarithm we wish to find

Example - Basic usage

The log2 command is simple and intuitive to use:

create log_field from log2(some_value)
create log_field from some_value.log2()

This command will create a new field, log_field which is equal to the log to base 2 of some_value.

Note

some_value MUST be a numerical type.