Skip to content
Vašek edited this page Jan 13, 2019 · 7 revisions

log2

This function returns the log base 2 of n

Syntax:

log2(n)
Argument Description
double n The input value

Returns: double

Description:

The function asks: "How many times number 2 must be powered by to equal n?" For example, function log2(4) will return 2, because 2x2 = 4.

Example:

double value;
value = log2(16);

This code will set value to 4, beacuse 2x2x2x2 = 16.

Example 2:

double value;
value = log2(5);

This code will set value to 2,321929.

Back to number_functions

Clone this wiki locally