## The Binary Number System (base 2)

The Binary Number System, unlike the Decimal Number System, where 10 figures are allowed (from 0 to 9), only needs 2 figures: “0” and “1”.

The Binary Number System is of special importance in digital electronics, where only two values are possible: the “1” or “high” voltage level and the “0” or “low” voltage level. The “1” and “0” are associated with: “high level” and “low level”, “closed” and “open”, “on” and “off”, “high” and “low”, etc.

To avoid confusion with other number systems, it is customary to place a “2” as a subscript at the end of the binary number. Examples: 1011_{2}, 111_{2}, 101001_{2}.

There is another way to encode a decimal number in binary, and it is using the BCD Code or **Binary Coded Decimal Code**, where each decimal digit is represented by a fixed number of binary digits (4 or 8).

## How to convert from Binary to Decimal?

Analyze the following image. A number in the Binary Number System is divided into digits with different weights: 1, 2, 4, 8, 16, 32, 64, 128, . . . . , etc. Each weight has an associated power.

On the first digit (from right to left) the power of two is 2^{0}, on the second digit the power of two is 2^{1} and so on until the last digit on the left side. So, to form the number 1010_{2}: (the number 10 in binary), proceed as shown in the following image.

## How to convert from Decimal to Binary?

To convert a decimal number to binary, successive divisions by 2 are made to the number to be converted, as seen in the following image.

These successive divisions give remainders (“0” or “1”). These “0” and “1” plus the quotient of the last division form the binary number that is read from right to left.

So, the number 174_{10} (decimal) is equal to 10101110_{2} (binary).

## The decimal part in the Binary Number System

Binary numbers can also be expressed with a decimal part. For example: 11100.101_{2}. In this case, the weight of the figures in the decimal part is established as follows:

- The first figure after the comma has a weight of 1/2.
- The figure digit after the comma has a weight of 1/4.
- The third figure after the comma has a weight of 1/8.
- The fourth figure after the comma has a weight of 1/16.
- Etc.

For example: Convert the previous number: 11100.1010_{2}, to its equivalent in decimal using the weight of each digit.

- 1 – 1 x 16 = 16
- 1 – 1 x 8 = 8
- 1 – 1 x 4 = 4
- 0 – 0 x 2 = 0
- 0 – 0 x 1 = 0

period (.)

- 1 – 1 x 1/2 = 0.5
- 0 – 0 x 1/4 = 0
- 1 – 1 x 1/8 = 0.125
- 0 – 1 x 1/16 = 0

Adding all the previous results, the equivalent value in the decimal number system is obtained.

16 + 8 + 4 + 0 + 0 + 0.5 + 0 + 0.125 = 28.625 in the decimal number system (28.625_{10})