Humans are used to working with decimal numbers, but computers uses machine language which is in binary, meaning that there are only 0s and 1s. Each 0 or 1 is called a bit, and bits are organized into groups of 8 called bytes. In the context of computers, we can define other types of number systems as follows:
- Decimal number system
- Binary number system
- Octal number system
- Hexadecimal number system
Decimal Number System (Base 10)
In this number system, the digits 0 to 9 represent the numbers. As it uses 10 digits to represent a number, it is also called the base 10 number system. Each digit has a value based on its position called place value.
The digit in the right-most position has a value of 1, and the next digit to the left has a value of 10. Since the base is 10, each position or place has a value that is 10 times as much as the previous position, as we move from right to left.
For example, let’s consider the decimal number 7862. In order to calculate the value of this number, we need to multiply each digit with its place value and add the resulting products.
=7 x 103 + 8 x 102 + 6 x 101 + 2 x 100
= 7 x 1000 + 8 x 100 + 6 x 10 + 2 x 1
= 7000 + 800 + 60 + 2
The right-most position is called the least significant symbol, and the left-most position is called the most significant symbol. With the number 7862, the 7 is the most significant symbol, and the 2 is the least significant symbol.
Binary Number System (Base 2)
A computer can understand only the “on” and “off” state of a switch. These two states are represented by 1 and 0. The combination of 1 and 0 form binary numbers. As only two digits are used to represent numbers, it is called a binary or base 2 number system. Instead of representing numbers as individual units (like the number 3 0r 5000), we use groups of 1s and 0s.
The binary number system also uses positional notation. But in this case, since the base is 2, each digit is multiplied by the appropriate power of 2 based on its position or place.
Binary number: 1 0 1 1 0
Place Value: 24 23 22 21 20
Octal Number System (Base 8)
This system uses digits 0 to 7 (i.e. 8 digits) to represent a number. The octal system groups binary numbers into triplets. So, the octal system is base-8, since 23 = 8. So, the place values will be ascending in powers of 8 from right to left.
Hexadecimal Number System (Base 16)
In this system, 16 digits are used to represent a given number. Thus it is also known as the base 16 number system.
Each digit position represents a power of 16 and the place value of each position in a hexadecimal number increases by a factor of 16 as we move from right to left. As the base is greater than 10, the number system is supplemented by letters. The symbols used in hexadecimal system are the numbers 0 to 9 followed by the letters A to F
Binary to Decimal
We know that the binary system has place values of powers of 2. These values are weights for the digits (0 or 1) in those positions. Firstly, multiply each digit of the binary number by its weight and then sum them all up to get the decimal number.
= 1 x 27+1 x 26 + 0 x 25 + 0 x 24+1 x 23 + 0 x 22 +1 x 21 + 0 x 20
= 128 + 64 + 0 + 0 + 8 + 0 + 2 + 0
Note: Weight of the positions from right to left are as 20, 21, 22, 23… and so on, for the integer part and weight of the positions from left to right are as 2-1, 2-2, 2-3, 2-4… and so on, for the fractional part.
= 1 x 23 + 0 x 22 +1 x 21 + 0 x 20 +1 x 2-1 + 0 x 2-2 +1 x 2-3 +1 x 2-4
= 8 + 0 + 2 + 0 + 0.5 + 0 + 0.125 + 0.0625
Decimal to Binary
One method to convert decimal integers to binary is by repeatedly dividing by 2 until the quotient reaches zero and keeping track of the remainders. However, in case it is a fraction, we multiply the fractional part by 2 until 0.00 is obtained.
Example: For the decimal (10.25)10
Therefore, (10.25)10 = (1010.01)2
Decimal to Octal
It is similar to the binary conversions. However, in place of 2, we divide the integer by 8 and note the remainders and continue this process until the quotient becomes less than 8. Similarly, for the fractional part, we multiply the decimal number by 8 until the decimal part .00 is obtained.
(10)10 = (12)8.
0.25 x 8 = 2.00
(.25)10 = (.2)8
Thus, (10.25)10 = (12.2)8
Octal to Decimal
Again, similar to binary, we multiply each digit of the octal number by its weight and then sum them all up to get the decimal number.
=1 x 81 + 2 x 80 +2 x 8-1
=1 x 8 + 2 x 1 + 2 x 0.125
(12.2)8 = (10.25)10
Hexadecimal to Decimal
Since the place values in hexadecimal are powers of 16, we multiply each digit of the number by its weight and then sum them all up to get the decimal number.
Hexadecimal to Binary
For this, we will group the binary digits into sets of four (starting on the right). Then, we replace each quartet with the corresponding hexadecimal representation.
Leave a Reply