What are Number systems? How to convert one number system into another?

# Technical studies – study 14

Introduction

The system of writing numbers is known as number system. In digital electronics number systems are used for operations.

In any number system the left most digit of a number that has the highest positional value is called as most significant digit (MSD) and the right most digit of that number that has the lowest positional value is called as least significant digit (LSD). 

Here we are going to discuss four major number systems used in digital systems.

  • Decimal number system
  • Binary number system
  • Octal number system
  • Hexadecimal number system

Decimal number system:

We have already studied this number system. We started studying number by decimal number system. In our day to day calculations we use decimal number system. This number system has ten symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9. We can represent any kind of number using these symbols. As this number system has ten symbols, the base or radix of this system is ten.

This system has both integer and fractional parts and divided by a decimal point.

 The value of a decimal number depends on the positional weight of that number as shown below.

Consider a mixed decimal number 8579.564, the value of this number according to position weight can be-   

8579.564 =  (8×1000) + (5×100) + (7×10) + (9×1)

                     +(5×110) + (6×1100) + (4×11000)      

                 =   (8×103) + (5×102) + (7×101) + (9×100) + (5×101)   

                       + (6×102) + (4×103)

                 = 8000 + 500 + 70 + 9 + 0.5 + 0.06 + 0.004

                 = 8579.564 

 

                

     

9’s complement and 10’s complement:

In decimal number system 9’s complement and 10’s complement method is used for subtraction. 9’s complement of a number can be acquired by subtracting each digits of that number from 9. 10’s complement of a number can be acquired by adding a 1 to the 9’s complement of that number.

Example 1:
Example 2:

9’s complement method of subtraction:

In this method the 9’s complement of subtrahend is obtained and added to the minuend. If a carry arrives in the result, the answer is positive. That carry is added to the LSB of the result to get final result. If no carry arrives in the result, the answer is negative. Take 9’s complement of the result to get the final result.

Example

10’s complement method of subtraction:

In this method the 10’s complement of the subtrahend is obtained and added to the minuend. If a carry arrives in the result, the answer is positive. That carry is ignored. The obtained result is the final result.  If no carry arrives in the result, the answer is negative. Take 10’s complement of the result to get the final result.

Example

Binary Number System:

Binary means two, so this system has two symbols- 0 and 1. The base or radix of this system is two. The digits used in a binary number are called bits.

Binary number system used in digital computers, because digital computers use switching circuits that have only two possible states. These two states can be represented by the two binary symbols – 0 and 1.

This system has both integer and fractional parts and separated by a binary point.

Binary addition:

The rules for binary addition are-

 0 + 0 = 0, 0 + 1 = 1, 1 + 0 = 1, 1 + 1 = 10

Example: 10110+11010= 110000

Binary subtraction:

The rules for binary subtraction are –

0 – 0 = 0, 0 – 1 = 1, 1 – 0 = 1, 1 – 1 = 0

Example: 1110011 – 111001 = 111010

Binary multiplication:

The rules for binary multiplication are-

0 x 0 = 0, 0 x 1 = 0, 1 x 0 = 0, 1 x 1 = 1

Example: 1101 x 101 =1000001

Binary division:

Binary division has the same rules and procedure that used in decimal number system.

Example: 101101 / 110 = 111.1

1’s complement and 2’s complement:

In binary number system 1’s complement and 2’s complement is used for subtraction. 1’s complement of a number can be obtained by complementing all digits of that number, which is changing all 0s to 1s and all 1s to 0s. 2’s complement of a number can be obtained by adding a 1 to the 1’s complement of that number.

Example 1:

Get 1’s complement of 18.

Solution:-

Given decimal number – 18

Convert it to binary –

18 = 00010010

Now complement each bit of the binary number – 

               00010010

               11101101

Therefore 1’s complement of 18 is 11101101

Example 2:

1’s complement method of subtraction:

In this method of subtraction the 1’s complement of the subtrahend is obtained and added to the minuend. The MSB of the result defines the sign of the result. If the MSB is 0, the result is positive and that is the final result. If the MSB is 1, the result is negative and 1’s complement of the result is obtained and that is the final result. If a carry arrives in result, add that carry to the LSB of the result. This carry is called end around carry.

Example

2’s complement method of subtraction:

In this method of subtraction the 2’s complement of the subtrahend is obtained and added to the minuend. The MSB of the result define the sign of the result. If the MSB is 0, the result is positive and that is the final result. If the MSB is 1, the result is negative and 2’s complement of the result is obtained and that is the final result.    If a carry arrives in result, that carry is ignored.

Example

Octal number system:

Octal means 8. So the base or radix of this system is eight and has eight symbols – 0, 1, 2, 3, 4, 5, 6 and 7. As the base of this system is 8=2^3, we can represent every 3 digits of a binary number by an octal digit. The large binary numbers are represented in octal for easy understanding.

Octal Binary Decimal
0 000 0
1 001 1
2 010 2
3 011 3
4 100 4
5 101 5
6 110 6
7 111 7

Hexadecimal number system:

Binary numbers are good for computers but difficult for humans. So for human interpretation hexadecimal number system developed. This number system became popular, because this system allows direct communication between human and computer. In fact it is most commonly used number system in computer languages.

Hexadecimal system has 16 symbols- 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F. So the base or radix of this system is 16. We can represent every 4 digits of a binary number by one hexadecimal symbol, as the base 16=2^4. In computer the words are 8 bits, 16 bits, 32 bits and so on. Therefore using hexadecimal system these can easily represented.

Hexadecimal Binary Decimal
0 0000 0
1 0001 1
2 0010 2
3 0011 3
4 0100 4
5 0101 5
6 0110 6
7 0111 7
8 1000 8
9 1001 9
A 1010 10
B 1011 11
C 1100 12
D 1101 13
E 1110 14
F 1111 15

Decimal to binary conversion:

To convert a decimal number to binary we need to continuous divide integer part of that number by 2 and multiply the fractional part of that number by 2 continuously. This method of conversion is called double-dabble method.        

Example 1:
Example 2:

Binary to decimal conversion:

To convert a binary number to decimal we need to multiply each digit of that number with its position weight and add products to get the decimal number.

Example 1:

Convert the binary number (1100000)2 to decimal.

Solution:-

Given binary number – 1100000

Multiply the digits of the binary number with their position weights to get the decimal number –

1100000 = (1×26) + (1×25) + (0×24) + (0×23) + (0×22) + (0×21) + (0×20)

                = 64 + 32 + 0 + 0 + 0 + 0 + 0

                = 96

Therefore (1100000)2 = (96)10  

Example 2:

Convert the binary number (10110010.01)2 to decimal.

Solution:-

Given the binary number – 10110010.01

Multiply the digits of the binary number with their position weights to get the decimal number – 

10110010.01 = (1×27) + (0×26) + (1×25) + (1×24) + (0×23) + (0×22)

                         +(1×21) + (0×20) + (0×21) + (1×22)

                        = 128 + 0 + 32 + 16 + 0 + 0 + 2 + 0 + 0 + 0.25

                        = 178.25

Therefore (10110010.01)2 = (178.25)10

Decimal to octal conversion:

To convert a decimal number to octal we need to divide the integer part by 8 continuously and multiply the fractional part of that number by 8 continuously.

Example 1:
Example 2:

Octal to decimal conversion:

To convert an octal number to decimal, multiply each digit of that number with its position weight and add the products to get the decimal number.

Example 1:

Convert the octal number (262.2)8 to decimal.

Solution:-

Given octal number – 262.2

Multiply the digits of the octal number with their position weights to get the decimal number –

262.2 = (2×82) + (6×81) + (2×80) + (2×81)

          = 128 + 48 + 2 + (2×0.125)

          = 178 + 0.25

          = 178.25

Therefore (262.2)8 = (178.25)10

Example 2:

Convert the octal number (140)8 to decimal.

Solution:-

Given octal number – 140

Multiply the digits of the octal number with their position weights to get the decimal number –

140 = (1×82) + (4×81) + (0×80) 

       = 64 + 32 + 0

       = 96

Therefore (140)8 = (96)10

Decimal to hexadecimal conversion:

To convert a decimal number to hexadecimal we need to divide the integer part by 16 continuously and multiply the fractional part of that number by 16 continuously.

Example 1:
Example 2:

Hexadecimal to decimal conversion:

To convert a hexadecimal number to decimal, multiply each digit of that number with its position weight and add the products to get the decimal number.

Example 1:

Convert the hexadecimal number (60)16 to decimal.

Solution:-

Given hexadecimal number – 60

Multiply the digits of hexadecimal number with their position weights to get the decimal number –

60 = (6×161) + (0×160)

     = 96 + 0

     = 96

Therefore (60)16 = (96)10

Example 2:

Convert the hexadecimal number (B2.4)16  to decimal. 

Solution:-

Given hexadecimal number – B2.4

Multiply the digits of the hexadecimal number with their position weights to get the decimal number –

B2.4 = (B×161) + (2×160) +(4×161)

         = 176 + 2 + (4×0.0625)

         = 178 + 0.25

         = 178.25

Therefore (B2.4)16 = (178.25)10

Binary to hexadecimal conversion:

To convert a binary number to hexadecimal make groups of every 4 bits starting from the left side and replace each group by its equivalent hexadecimal digit.

Example 1

Convert the binary number (1100000)2 to hexadecimal.

Solution:-

Given the binary number – 1100000 

Arrange the bits of the number in to group of four bits – 

                      0110    0000

Now write the equivalent hexadecimal digits for each group – 

             0110  0000 

               6        0   

 Therefore (1100000)2  = (60)16

 

Example 2

Convert the binary number (10110010.01)2 to hexadecimal. 

Solution :-

Given binary number -10110010.01

Arrange the bits of the binary number in groups of four bits –

                 1011       0010  .    0100

Now write the equivalent hexadecimal digits for each group. 

               1011       0010  .  0100

                 B               2     .     4

Therefore (10110010.01)2(B2.4)16

 

 

Hexadecimal to binary conversion:

To convert a hexadecimal number to binary replace each digit of that number with 4 binary digits.

Example 1:

Convert the hexadecimal number (60)16 to binary.

Solution:-

Given hexadecimal number – 60

Write the equivalent binary bits for each digit of the hexadecimal number.

                         6                     0 

                     0110                0000

Therefore (60)16(01100000)2

Example 2:

Convert the hexadecimal number (B2.4)16 to binary.

Solution:-

Given hexadecimal number – B2.4

Write the equivalent binary bits for each digit of the hexadecimal number.

                    B              2  .      4

                 1011      0010 .  0100

Therefore (B2.4)16(10110010.0100)2

 

Binary to octal conversion:

To convert a binary number to octal make groups of every 3 bits starting from the left side and replace each group by its equivalent octal digit.

Example 1:

Convert the binary number (10110010.01)2 to octal.

Solution:-

Given binary number -10110010.01

Arrange the number to group of three bits –

          010   110  010  . 010

Now write the equivalent octal digits for each group  – 

          010     110   010  . 010

            2         6         2    .   2

Therefore (10110010.01)2(262.2)8

Example 2:

Convert the binary number (1100000)2 to octal.

Solution:-

Given binary number – 1100000

Arrange the number to group of three bits –

      001    100   000

Now write the equivalent octal digits for each group –

        001    100   000

          1         4       0

Therefore (1100000)2(140)8

Octal to binary conversion:

To convert an octal number to binary replace each digit of that number with 3 binary digits.

Example 1:

Convert the octal number (262.2)8 to binary.

Solution:-

Given octal number – 262.2

Convert each digit of the octal number to group of three binary digits –

           2         6        2   .   2

        010      110   010 .  010

Therefore (262.2)8(10110010.01)2

Example 2:

Convert the octal number (140)8 to binary.

Solution:-

Given octal number – 140

Convert each digit of the octal number to group of three binary bits –

                  1        4          0

                001    100      000

Therefore (140)8  = (1100000)2

Octal to hexadecimal conversion:

To convert an octal number to hexadecimal, first convert the octal number to binary then convert that binary number to hexadecimal number.

Example 1:

Convert the octal number (262.2)8 to hexadecimal.

Solution:-

Given octal number – 262.2

Convert each digit of the octal number in group of three binary bits –

             2           6            2.      2   

           010       110        010.   010

Now arrange the bits in group of four binary bits –

                   010     110     010 .   010

                       1011     0010  .    0100

Now write the equivalent hexadecimal digits for each group –

                  1011       0010  .     0100

                     B            2  .          4

Therefore (262.2)8  = (B2.4)16

Example 2:

Convert the octal number (140)8 to hexadecimal. 

Solution:-

Given octal number – 140 

Convert each digit of the octal number in group of three binary bits – 

                  1            4              0

               001         100          000

Now arrange the binary bits in group of four bits –

             001          100      000

                 0110    0000

Now write the equivalent hexadecimal digits for each group –

               0110       0000

                 6              0

Therefore (140)8(60)16

Hexadecimal to octal conversion:

To convert a hexadecimal number to octal, first convert the hexadecimal number to binary then convert that binary number to octal number.

Example 1:

Convert the hexadecimal number (B2.4)16 to octal.

Solution:-

Given hexadecimal number – B2.4

Convert each digit of the hexadecimal number in group of four binary bits-

            B                   2   .       4

        1011              0010.   0100

Now arrange the bits in group of three bits –

           1011       0010   .    0100

          010   110    010  .  010

 Now write the equivalent octal digits for each group.

           010    110   010  .  010

             2        6       2   .      2

Therefore (B2.4)16(262.2)8

Example 2:

Convert the hexadecimal number (60)16 to octal.

Solution:-

Given hexadecimal number – 60

Convert each digit of the hexadecimal number in group of four binary bits –

                6            0

            0110       0000

Now arrange the bits in group of three bits –

             0110    0000

          001    100    000

Now write the equivalent octal digits for each group.

         001       100     000

          1             4         0

Therefore (60)16(140)8

Please write in the comment box below if you have any doubts.

Leave a Reply

Your email address will not be published. Required fields are marked *