Binary stands for 2. Therefore, the log function with base 2 is known as binary logarithm.

If 2$^{x}$ = n, then $log_{2}$ (n) = x is the binary logarithm.

For example, the binary log of 1 is zero since 2$^{0}$ = 1. Similarly, the binary log of 4 is 2 since 2$^{2}$ = 4 and hence so on.

We can easily convert bases of logs by a simple rule, that is, we can change base from 2 to some other number and vice versa as follows.

$log_{2}$ (n) = $\frac{ln n}{ln 2}$ = $\frac{log_{10} (n)}{log_{10} (2)}$

This way we can convert base from binary to natural log and also to base 10. Similarly we can base 10 or natural log to binary based logarithmic function.

## Binary Logarithm Formula

A more common notation of binary log is lg.

That is 2$^{x}$ = n is equivalent to lg n = x.

Like ‘ln’ denotes natural logarithm, in same way ‘lg’ denotes binary logarithm.

## Binary Logarithm Rules

Like other logarithms binary logarithms follows the same rules as well. They are

Lg m + lg n = lg mn

Lg m - lg n = lg ($\frac{m}{n}$)

n lg m = lg (m$^{n}$)

lg (n root m) = $\frac{1}{n}$ lg m

lg n = lg m . $log_{m}$ (n)

## Integer Binary Logarithm

Here we have $log_{2}$ (n) = x

$\Rightarrow$  2$^{x}$ <= n < 2$^{(x + 1)}$

This implies that integer ‘x’ is such that $\frac{n}{2^{x}}$ $\neq$ 0 and $\frac{[n]}{[2^{(x + 1)}]}$ = 0

## Binary Logarithm Function

The binary logarithm can be written in a function from and to integers easily by using the rounding up or down technique. We can relate these two techniques by the formula below:

[$log_{2}$ (n)]   = [$log_{2}$ (n + 1)] - 1

This holds true for n >= 1.

If we define [$log_{2}$ (0)] = -1, then we can extend the formula easily. In this way when we extend the function, it gets related to the number of zeroes that are leading in 32 bit unsigned binary representation of ‘x’, nlz (x).

## Binary Logarithm Table

$x$ $log_{10} x$ $log_{2} x$ $log_{e} x$
0 Undefined Undefined Undefined
0$^{+}$ - $\infty$ - $\infty$   - $\infty$
0.0001 -4 -13.287712 -9.21034
0.001 -3 -9.965784 -6.907755
0.01 -2 -6.643856 -4.60517
0.1 -1 -3.321928 -2.302585
1 0 0 0
2 0.30103 1 0.693147
3 0.477121 1.584963 1.098612
4 0.60206 2 1.386294
5 0.69897 2.321928 1.609438
6 0.778151 2.584963 1.791759
7 0.845098 2.807355 1.94591
8 0.90309 3 2.079442
9 0.954243 3.169925 2.197225
10 1 3.321928 2.302585
20 1.30103 4.321928 2.995732
30 1.477121 4.906891 3.401197
40 1.60206 5.321928 3.688879
50 1.69897 5.643856 3.912023
60 1.778151 5.906991 4.094345
70 1.845098 6.129283 4.248495
80 1.90309 6.321928 4.382027
90 1.954243 6.491853 4.49981
100 2 6.643856 4.60517
200 2.30103 7.643856 5.298317
300 2.477121 8.228819 5.703782
400 2.60206 8.643856 5.991465
500 2.69897 8.965784 6.214608
600 2.778151 9.228819 6.39693
700 2.845098 9.451211 6.55108
800 2.90309 9.643856 6.684612
900 2.954243 9.813781 6.802395
1000 3 9.965784 6.907755
10000 4 13.287712 9.21034

This table gives values for $log_{10} x$, $log_{2} x$ and $log_{e} x$ which makes it easier to calculate or compare the values as well.

## Binary Logarithm Algorithm

In the iterative part of the log algorithm we assumed that 1 <= x < 2, therefore, we might require to normalize x. This process of normalization is performed by simple and successive steps of division or multiplication by two. These division or multiplication by two might also be efficiently effected by some binary shifts. The number of division or multiplication done gives the characteristic value of the logarithm result. This will now be added to the mantissa in order to obtain the complete form of the logarithm. The count of division and the count of multiplication is taken as a positive and a negative number respectively.

As x is properly scaled, we get that 0 <= y < 1.

We have y = 2$^{(-1)}$ ($y_{1}$ + 2$^{(-1)}$ ($y_{2}$ + 2$^{(-1)}$ ($y_{3}$ + ….)))

Also, x = 2$^{y}$

We substitute and square and get

X$^{2}$ = 2$^{(y_{1})}$ 2$^{(2^{(-1)})}$ ($y_{2}$ + 2$^{(-1)}$ ($y_{3}$ + …)))

Either $y_{1}$ = 0 or $y_{1}$ = 0 in either case we get

X$^{2}$ = 2$^{(2^{(-1)}}$($y_{2}$ + 2$^{(-1)}$($y_{3}$ + …)))

## Applications of Binary Logarithm

Logarithms are widely used in mathematics to ease computations, in determining rate of growth or decays, rate of reproduction, and at times in calculating interest or loan amounts as well.

Logarithm also helps in scaling the Richter scale that is used to measure the intensity of earthquakes.

The binary system is useful in field of computers as well to calculate the bit system. Computers only works on binary number system so in conversion of this decimal to binary system, for higher numbers and terms, the logs are very useful including the table of 2 both ways.