Number Base ConversionIn our previous section, we learned different types of number systems such as binary, decimal, octal, and hexadecimal. In this part of the tutorial, we will learn how we can change a number from one number system to another number system. As, we have four types of number systems so each one can be converted into the remaining three systems. There are the following conversions possible in Number System
Binary to other Number SystemsThere are three conversions possible for binary number, i.e., binary to decimal, binary to octal, and binary to hexadecimal. The conversion process of a binary number to decimal differs from the remaining others. Let's take a detailed discussion on Binary Number System conversion. Binary to Decimal ConversionThe process of converting binary to decimal is quite simple. The process starts from multiplying the bits of binary number with its corresponding positional weights. And lastly, we add all those products. Let's take an example to understand how the conversion is done from binary to decimal. Example 1: (10110.001)_{2} We multiplied each bit of (10110.001)_{2} with its respective positional weight, and last we add the products of all the bits with its weight. (10110.001)_{2}=(1×2^{4})+(0×2^{3})+(1×2^{2})+(1×2^{1})+(0×2^{0})+ Binary to Octal ConversionThe base numbers of binary and octal are 2 and 8, respectively. In a binary number, the pair of three bits is equal to one octal digit. There are only two steps to convert a binary number into an octal number which are as follows:
Example 1: (111110101011.0011)_{2} 1. Firstly, we make pairs of three bits on both sides of the binary point. 111 110 101 011.001 1 On the right side of the binary point, the last pair has only one bit. To make it a complete pair of three bits, we added two zeros on the extreme side. 111 110 101 011.001 100 2. Then, we wrote the octal digits, which correspond to each pair. (111110101011.0011)_{2}=(7653.14)_{8} Binary to Hexadecimal ConversionThe base numbers of binary and hexadecimal are 2 and 16, respectively. In a binary number, the pair of four bits is equal to one hexadecimal digit. There are also only two steps to convert a binary number into a hexadecimal number which are as follows:
Example 1: (10110101011.0011)_{2} 1. Firstly, we make pairs of four bits on both sides of the binary point. 111 1010 1011.0011 On the left side of the binary point, the first pair has three bits. To make it a complete pair of four bits, add one zero on the extreme side. 0111 1010 1011.0011 2. Then, we write the hexadecimal digits, which correspond to each pair. (011110101011.0011)_{2}=(7AB.3)_{16} Decimal to other Number SystemThe decimal number can be an integer or floatingpoint integer. When the decimal number is a floatingpoint integer, then we convert both part (integer and fractional) of the decimal number in the isolated form(individually). There are the following steps that are used to convert the decimal number into a similar number of any base 'r'.
Decimal to Binary ConversionFor converting decimal to binary, there are two steps required to perform, which are as follows:
Example 1: (152.25)_{10} Step 1: Divide the number 152 and its successive quotients with base 2.
(152)_{10}=(10011000)_{2} Step 2: Now, perform the multiplication of 0.27 and successive fraction with base 2.
(0.25)_{10}=(.01)_{2} Decimal to Octal ConversionFor converting decimal to octal, there are two steps required to perform, which are as follows:
Example 1: (152.25)_{10} Step 1: Divide the number 152 and its successive quotients with base 8.
(152)_{10}=(230)_{8} Step 2: Now perform the multiplication of 0.25 and successive fraction with base 8.
(0.25)_{10}=(2)_{8} So, the octal number of the decimal number 152.25 is 230.2 Decimal to hexadecimal conversionFor converting decimal to hexadecimal, there are two steps required to perform, which are as follows:
Example 1: (152.25)_{10} Step 1: Divide the number 152 and its successive quotients with base 8.
(152)_{10}=(98)_{16} Step 2: Now perform the multiplication of 0.25 and successive fraction with base 16.
(0.25)_{10}=(4)_{16} So, the hexadecimal number of the decimal number 152.25 is 230.4. Octal to other Number SystemLike binary and decimal, the octal number can also be converted into other number systems. The process of converting octal to decimal differs from the remaining one. Let's start understanding how conversion is done. Octal to Decimal ConversionThe process of converting octal to decimal is the same as binary to decimal. The process starts from multiplying the digits of octal numbers with its corresponding positional weights. And lastly, we add all those products. Let's take an example to understand how the conversion is done from octal to decimal. Example 1: (152.25)_{8} Step 1: We multiply each digit of 152.25 with its respective positional weight, and last we add the products of all the bits with its weight. (152.25)_{8}=(1×8^{2})+(5×8^{1})+(2×8^{0})+(2×8^{1})+(5×8^{2}) So, the decimal number of the octal number 152.25 is 106.328125 Octal to Binary ConversionThe process of converting octal to binary is the reverse process of binary to octal. We write the three bits binary code of each octal number digit. Example 1: (152.25)_{8} We write the threebit binary digit for 1, 5, 2, and 5. (152.25)_{8}=(001101010.010101)_{2} So, the binary number of the octal number 152.25 is (001101010.010101)_{2} Octal to hexadecimal conversionFor converting octal to hexadecimal, there are two steps required to perform, which are as follows:
Example 1: (152.25)_{8} Step 1: We write the threebit binary digit for 1, 5, 2, and 5. (152.25)_{8}=(001101010.010101)_{2} So, the binary number of the octal number 152.25 is (001101010.010101)_{2} Step 2: 1. Now, we make pairs of four bits on both sides of the binary point. 0 0110 1010.0101 01 On the left side of the binary point, the first pair has only one digit, and on the right side, the last pair has only twodigit. To make them complete pairs of four bits, add zeros on extreme sides. 0000 0110 1010.0101 0100 2. Now, we write the hexadecimal digits, which correspond to each pair. (0000 0110 1010.0101 0100)_{2}=(6A.54)_{16} Hexadecimal to other Number SystemLike binary, decimal, and octal, hexadecimal numbers can also be converted into other number systems. The process of converting hexadecimal to decimal differs from the remaining one. Let's start understanding how conversion is done. Hexadecimal to Decimal ConversionThe process of converting hexadecimal to decimal is the same as binary to decimal. The process starts from multiplying the digits of hexadecimal numbers with its corresponding positional weights. And lastly, we add all those products. Let's take an example to understand how the conversion is done from hexadecimal to decimal. Example 1: (152A.25)_{16} Step 1: We multiply each digit of 152A.25 with its respective positional weight, and last we add the products of all the bits with its weight. (152A.25)_{16}=(1×16^{3})+(5×16^{2})+(2×16^{1})+(A×16^{0})+(2×16^{1})+(5×16^{2}) So, the decimal number of the hexadecimal number 152A.25 is 5418.14453125 Hexadecimal to Binary ConversionThe process of converting hexadecimal to binary is the reverse process of binary to hexadecimal. We write the four bits binary code of each hexadecimal number digit. Example 1: (152A.25)_{16} We write the fourbit binary digit for 1, 5, A, 2, and 5. (152A.25)_{16}=(0001 0101 0010 1010.0010 0101)_{2} So, the binary number of the hexadecimal number 152.25 is (1010100101010.00100101)_{2} Hexadecimal to Octal ConversionFor converting hexadecimal to octal, there are two steps required to perform, which are as follows:
Example 1: (152A.25)_{16} Step 1: We write the fourbit binary digit for 1, 5, 2, A, and 5. (152A.25)_{16}=(0001 0101 0010 1010.0010 0101)_{2} So, the binary number of hexadecimal number 152A.25 is (0011010101010.010101)_{2} Step 2: 3. Then, we make pairs of three bits on both sides of the binary point. 001 010 100 101 010.001 001 010 4. Then, we write the octal digit, which corresponds to each pair. (001010100101010.001001010)_{2}=(12452.112)_{8} So, the octal number of the hexadecimal number 152A.25 is 12452.112
Next TopicGray Code
