The logarithm of a number is the power to which you must raise the base in order to produce this number. The logarithm with base 10 is called the common logarithm and denoted as “log.” For example, log(1,000) is 3, as 10 raised in the power of 3 produces 1,000. Every scientific calculator has a built-in function to calculator log of any number (typically the button “log”). But you rarely see a calculator which performs a log2 function, which is logarithm with base 2, directly. As an example, calculate log2 of the number “12” i.e. log2(12).
To calculate the base 2 logarithm of a number (y), divide the common log of y by the common log of 2.
Set up the Expression
Express log2(y) of any number y via log(y). According to the logarithm definition y=2(log2(y)). Take log of both sides of the equation to get log(y)=log(2(log2(y)) = log(2) × log2(y). Then divide both sides by log(2) and rearrange to get log2(y)=log(y)÷log(2).
Calculate log(2) with a calculator. Enter “2” and press the “log” button. log(2)=0.30103. Write down this constant as it will be used in all calculations of log2.
Calculate log(y). Enter a number and press the “log” button. In our example, log(12)= 1.07918.
Divide the result from the last step by the constant log(2) obtained above to get log2(y). In our example, it would be log2(12)=log(12)÷log(2)=1.07918÷0.30103 = 3.584958.