-
-
Notifications
You must be signed in to change notification settings - Fork 18
log2
drewmccluskey edited this page Jan 14, 2019
·
7 revisions
This function returns the log base 2 of n
log2(n)
Argument | Description |
---|---|
double n |
The input value |
Returns: double
The function asks: "How many times does the number 2 have to be multiplied by itself to equal n
?" For example, function log2(4) will return 2, because 2x2 = 4. There are 2 powers of 2 to equal 4.
double value;
value = log2(16);
This code will set value
to 4, beacuse 2x2x2x2 = 16. There are 4 powers of 2 to equal 16.
double value;
value = log2(5);
This code will set value
to 2.321929.
Back to number_functions