Lecture 02 Number Systems
Lecture 02 Number Systems
Lecture 02 Number Systems
Learning Objectives
1
o Understanding IP addressing in networking (e.g., binary representation of
addresses).
o Interpreting machine-level operations in computer systems.
6. Analyze and Solve Problems Efficiently:
Use number systems to solve computation-related problems, particularly in digital
logic and computer organization.
Number Systems
A digital number system is a positional number system that has some symbols called digits. It
provides a complete set of digits, operators, and rules to perform operations.
In a digital number system, the number of digits used determines the base of the number system.
For example, the binary number system has two digits (0 and 1), hence, the base of the binary
number system is 2.
Digital number systems form the foundation of the modern computing technologies and digital
electronics. They are used to represent, process, and manipulate the information using a digital
system.
In this chapter, we will discuss the fundamental concepts of different types of digital number
systems.
Binary number system has two symbols or digits, i.e., 0 and 1. Hence, these two digits are used to
represent information and perform all the digital operations. Each binary digit is called a bit.
Since there are two digits are used in the binary number system, hence its base is 2. Therefore, the
value of a binary number is calculated as the sum of powers of 2.
2
Binary digits are used in digital system to represent their ON and OFF states. Where, 0 is used to
represent the OFF state of the digital system and 1 is used to represent the ON state of the system.
Overall, the binary number system forms the foundation of computation, digital communication,
and digital information storage.
Example
Consider the binary number 1101.011. The integer part of this number is 1101 and the fractional
part of this number is 0.011. The digits 1, 0, 1 and 1 of the integer part have weights of 2 0, 21, 22,
23 respectively. Similarly, the digits 0, 1 and 1 of fractional part have weights of 2 -1, 2-2, 2-
3
respectively.
1101.011=(1×23)+(1×22)+(0×21)+(1×20)+(0×2−1)+(1×2−2)+(1×2−3)
After simplifying the right-hand side terms, we will get a decimal number, which is an equivalent
of binary number on left-hand side.
Decimal number system is a base 10 number system having 10 unique digits i.e., 0, 1, 2, 3, 4, 5, 6,
7, 8, and 9. It is the standard number system used by human beings to represent information in a
natural way. However, a digital system cannot directly process the information represented in
decimal form, so it is converted into binary form and then processed.
The base of the decimal number system is 10. So, the value of a decimal number is calculated by
the sum of powers of 10.
Example
Consider the decimal number 1358.246. The integer part of this number is 1358 and the fractional
part of this number is 0.246. The digits 8, 5, 3 and 1 have weights of (10) 0, (10)1, (10)2 and
(10)3 respectively. Similarly, the digits 2, 4 and 6 have weights of (10)-1, (10)-2 and (10)-
3
respectively.
1358.246=(1×103)+(3×102)+(5×101)+(8×100)+(2×10−1)+(4×10−2)+(6×10−3)
After simplifying the right-hand side terms, we will get the decimal number, which is on the left-
hand side.
3
Octal Number System
The octal number system is another type of digital number system used in the field of digital
electronics to represent information. It is a base 8 number system having eight unique digits i.e., 0,
1, 2, 3, 4, 5, 6, and 7.
It is important note that the octal number system is equivalent to 3-bit binary number system as
23 = 8. Hence, this number system can be used in computing and digital electronic applications.
The value of an octal number is obtained by the sum of powers of 8, as 8 is the base of the octal
number system.
Octal number system is used in the field of digital electronics to represent binary information in
compact form, permissions in Linux or Unix systems, IPv6 address, binary machine code
instructions, in error detection algorithms, etc.
Example
Consider the octal number 1457.236. Integer part of this number is 1457 and fractional part of this
number is 0.236. The digits 7, 5, 4 and 1 have weights of (8)0, (8)1, (8)2 and (8)3 respectively.
Similarly, the digits 2, 3 and 6 have weights of (8)-1, (8)-2, (8)-3 respectively.
1457.236=(1×83)+(4×82)+(5×81)+(7×80)+(2×8−1)+(3×8−2)+(6×8−3)
After simplifying the right-hand side terms, we will get a decimal number, which is an equivalent
of octal number on the left-hand side.
In the field of digital electronics, the hexadecimal number system is used in memory address
representation, digital colors representation, low level computer programming, encoding, assembly
language programming, microcontrollers, keyboards, etc. Hexadecimal number system creates a
balance between digital representation and human readability.
Example
Consider the hexadecimal number 1A05.2C4. The integer part of this number is 1A05 and the
fractional part of this number is 0.2C4. The digits 5, 0, A and 1 have weights of (16) 0, (16)1,
(16)2 and (16)3 respectively. Similarly, the digits 2, C and 4 have weights of (16)-1 , (16)-2 and (16)-
3
respectively.
4
Mathematically, we can write it as,
1A05.2C4=(1×163)+(10×162)+(0×161)+(5×160)+(2×16−1)+(12×16−2)+(4×16−3)
After simplifying the right-hand side terms, we will get a decimal number, which is an equivalent
of the hexadecimal number on the left-hand side.
• Digital number systems provide a simple and consistent way of representing and
understanding information.
• Digital number systems allow to develop efficient methods for storage and transmission of
digital information.
• Digital number systems provide methods of representing different types of information like
text, numbers, images, etc.
• Digital number systems allow to convert information from one form to full fill the needs of
applications.
• Digital number systems create compatibility between hardware and software.
• Information Representation
• Digital Communication
• Storage and Transmission of Digital Data and Information
• Algorithm Development
• System Programming, etc.
Unsigned Numbers
Unsigned numbers contain only magnitude of the number. They don’t have any sign. That means
all unsigned binary numbers are positive. As in decimal number system, the placing of positive
sign in front of the number is optional for representing positive numbers. Therefore, all positive
5
numbers including zero can be treated as unsigned numbers if positive sign is not assigned in front
of the number.
Signed Numbers
Signed numbers contain both sign and magnitude of the number. Generally, the sign is placed in
front of number. So, we have to consider the positive sign for positive numbers and negative sign
for negative numbers. Therefore, all numbers can be treated as signed numbers if the corresponding
sign is assigned in front of the number.
If sign bit is zero, which indicates the binary number is positive. Similarly, if sign bit is one, which
indicates the binary number is negative.
The bits present in the un-signed binary number holds the magnitude of a number. That means, if
the un-signed binary number contains ‘N’ bits, then all N bits represent the magnitude of the
number, since it doesn’t have any sign bit.
Example
Consider the decimal number 108. The binary equivalent of this number is 1101100. This is the
representation of unsigned binary number.
(108)10 = (1101100)2
It is having 7 bits. These 7 bits represent the magnitude of the number 108.
If the signed binary number contains ‘N’ bits, then (N-1) bits only represent the magnitude of the
number since one bit (MSB) is reserved for representing sign of the number.
• Sign-Magnitude form
• 1’s complement form
• 2’s complement form
6
Representation of a positive number in all these 3 forms is same. But, only the representation of
negative number will differ in each form.
Consider the positive decimal number +108. The binary equivalent of magnitude of this number
is 1101100. These 7 bits represent the magnitude of the number 108. Since it is positive number,
consider the sign bit as zero, which is placed on left most side of magnitude.
(+108)10 = (01101100)2
Therefore, the signed binary representation of positive decimal number +108 is 𝟎𝟏𝟏𝟎𝟏𝟏𝟎𝟎. So,
the same representation is valid in sign-magnitude form, 1’s complement form and 2’s complement
form for positive decimal number +108.
Sign-Magnitude form
In sign-magnitude form, the MSB is used for representing sign of the number and the remaining
bits represent the magnitude of the number. So, just include sign bit at the left most side of
unsigned binary number. This representation is similar to the signed decimal numbers
representation.
Example
Consider the negative decimal number -108. The magnitude of this number is 108. We know the
unsigned binary representation of 108 is 1101100. It is having 7 bits. All these bits represent the
magnitude.
Since the given number is negative, consider the sign bit as one, which is placed on left most side
of magnitude.
(−108)10 = (11101100)2
That means, if you perform two times 1’s complement of a binary number including sign bit, then
you will get the original signed binary number.
Example
Consider the negative decimal number -108. The magnitude of this number is 108. We know the
signed binary representation of 108 is 01101100.
7
It is having 8 bits. The MSB of this number is zero, which indicates positive number. Complement
of zero is one and vice-versa. So, replace zeros by ones and ones by zeros in order to get the negative
number.
(−108)10 = (10010011)2
That means, if you perform two times 2’s complement of a binary number including sign bit, then
you will get the original signed binary number.
Example
Consider the negative decimal number -108.
= 10010011 + 1
= 10010100
Binary Arithmetic
Binary arithmetic is one of the fundamental concepts in the field of digital electronics and computer
engineering. It is basically the mathematics of binary numbers allow to perform various arithmetic
operations on binary numbers. We know that the binary number system has two digits, i.e., 0 and
1 which are used to represent the ON or OFF states of the digital systems. Hence, binary arithmetic
forms the foundation of the digital computing.
In this chapter, we will discuss the following four main binary arithmetic operations −
• Binary Addition
• Binary Subtraction
• Binary Multiplication
• Binary Division
Let’s discuss each of these binary arithmetic operations in detail along with solved examples.
Binary Addition
8
In binary arithmetic, the process of adding two binary numbers is called binary addition. Where,
the binary numbers consist of only 0 and 1. In the binary addition, a carry is generated when the
sum is greater than 1.
0+0=0
0+1=1
1+0=1
1+1=10 (Sum=0&Carry=1)
Let us consider some examples to understand the binary addition.
Example 1
Add two binary numbers, 1101 and 1110.
Solution
The binary addition of the given binary numbers is described below −
Explanation
Add 1 (rightmost bit of first number) and 0 (rightmost bit of the second number). It gives 1 + 0 =
1 (thus, write down 1 as sum bit).
Add 0 (second rightmost bit of first number) and 1 (second rightmost bit of the second number). It
gives 0 + 1 = 1 (write down 1 as sum bit).
Add 1 (third rightmost bit of first number) and 1 (third rightmost bit of second number). It gives 1
+ 1 = 10 (write down 0 as sum and 1 as carry).
Add 1 (leftmost bit of the first number), 1 (leftmost bit of second number) and 1 (carry). It gives 1
+ 1 + 1 = 11 (write down 1 as sum and 1 as carry).
9
Thus, the result is 11011.
Example 2
Add 1010 and 11011.
Solution
The binary addition of given numbers is explained below −
Explanation
Add 0 (rightmost bit of first number) and 1 (rightmost bit of second number). It gives 0 + 1 = 1
(write down 1 as sum).
Add 1 (second rightmost bit of first number) and 1 (second rightmost bit of second number). It
gives 1 + 1 = 10 (write down 0 as sum and 1 as carry).
Add 0 (third rightmost bit of first number), 0 (third rightmost bit of second number), and 1 (carry).
It gives 0 + 0 + 1 = 1 (write down 1 as sum).
Add 1 (leftmost bit of first number) and 1 (second leftmost bit of second number). It gives 1 + 1 =
10 (write down 0 as sum and 1 as carry).
Add 1 (leftmost bit of second number) and 1 carry. It gives 1 + 1 = 10 (write down 0 as sum and 1
as the end around carry).
Binary Subtraction
In binary arithmetic, binary subtraction is a mathematical operation used to find the difference
between two binary numbers.
In binary subtraction, each bit of the binary numbers is subtracted, starting from the rightmost bit.
10
The binary subtraction is performed as per the following rules of binary arithmetic −
0–0=0
1–0=1
0–1=1(borrow1fromthenexthigherbit)0–1=1(borrow1fromthenexthigherbit)
1–1=0
Let us see some examples to understand the binary subtraction.
Example 1
Subtract 1100 from 1101.
Solution
The subtraction of given binary numbers is given below −
Explanation
Subtract 0 (rightmost bit of second number) from 1 (rightmost bit of first number). It gives 1 – 0 =
1 (write down 1 as difference).
Subtract 0 (second rightmost bit of second number) from 0 (second rightmost bit of first number).
It gives 0 – 0 = 0 as result.
Subtract 1 (third rightmost bit of second number) from 1 (third rightmost bit of first number). It
gives 1 – 1 = 0 as result.
Subtract 1 (leftmost bit of second number) from 1 (leftmost bit of first number). It gives 1 – 1 = 0
as result.
Example 2
Subtract 101 from 1111.
Solution
11
The subtraction of given binary numbers is explained below −
Explanation
Subtract rightmost bits: 1 – 1 = 0
Example 3
Subtract 1011 from 1101.
Solution
The binary subtraction of 1101 and 1011 is given below −
Explanation
Subtract rightmost bits: 1 – 1 = 0.
Subtract second rightmost bits: 0 – 1 = 1. A borrow 1 is taken from the next higher bit.
Binary Multiplication
12
In binary arithmetic, binary multiplication is the process of multiplying two binary numbers and
obtain their product.
In binary multiplication, we multiply each bit of one binary number by each bit of another binary
number and then add the partial products to obtain the final product.
0×0=0
0×1=0
1×0=0
1×1=1
It is clear that the binary multiplication is similar to the decimal multiplication. Let us understand
the binary multiplication with the help of solved examples.
Example 1
Multiply 1101 and 11.
Solution
The binary multiplication of given numbers is described below −
Explanation
Multiply the rightmost bit of the second number, 1 by each bit of the first number (1101).
Now, shift the partial product one position to the left to perform the next multiplication.
Multiply the leftmost bit of the second number, 1 by each bit of the first number (1101).
Finally, sum up all the partial products to obtain the final product.
13
Example 2
Multiply 11011 and 110.
Solution
The multiplication of given binary numbers is demonstrated below −
Explanation
Multiply rightmost bit of the second number (0) by each bit of the first binary number (11011).
Multiply the second rightmost bit of the second number (1) by each bit of the first binary number
(11011).
Multiply the leftmost bit of the second number (1) by each bit of the first number.
Then, sum up all the partial products to obtain the final product.
Binary Division
Binary division is one of the basic arithmetic operations used to find the quotient and remainder
when dividing one binary number by another.
0÷0=Undefined0
0÷1=0
14
1÷0=Undefined
1÷1=1withRemainder=0
Example 1
Divide 110011 by 11.
Solution
The division of the given binary numbers is explained below −
110011 ÷ 11 = 10001
In this example of binary division, the quotient obtained is 10001 and the remainder is 0.
Example 2
Divide 11011 by 10.
Solution
The binary division of 11011 by 10 is explained below −
11011 ÷ 10 = 1101
15
In this example, the quotient is 1101 and the remainder is 1.
If resultant sum is positive, you can find the magnitude of it directly. But, if the resultant sum is
negative, then take 2’s complement of it in order to get the magnitude.
Example 1
Let us perform the addition of two decimal numbers +7 and +4 using 2’s complement method.
The 2’s complement representations of +7 and +4 with 5 bits each are shown below.
(+7)10=(00111)2
(+4)10=(00100)2
The addition of these two numbers is
(+7)10+(+4)10=(00111)2+(00100)2
⇒(+7)10+(+4)10=(01011)2
The resultant sum contains 5 bits. So, there is no carry out from sign bit. The sign bit ‘0’ indicates
that the resultant sum is positive. So, the magnitude of sum is 11 in decimal number system.
Therefore, addition of two positive numbers will give another positive number.
16
Example 2
Let us perform the addition of two decimal numbers -7 and -4 using 2’s complement method.
The 2’s complement representation of -7 and -4 with 5 bits each are shown below.
(−7)10=(11001)2
(−4)10=(11100)2
The addition of these two numbers is
(−7)10+(−4)10=(11001)2+(11100)2
⇒(−7)10+(−4)10=(110101)2
The resultant sum contains 6 bits. In this case, carry is obtained from sign bit. So, we can remove
it
The sign bit ‘1’ indicates that the resultant sum is negative. So, by taking 2’s complement of it we
will get the magnitude of resultant sum as 11 in decimal number system. Therefore, addition of two
negative numbers will give another negative number.
A - B = A + (2's complement of B)
Similarly, if we have to subtract the number A from number B, then take 2’s complement of A and
add it to B. So, mathematically we can write it as
B - A = B + (2's complement of A)
So, the subtraction of two signed binary numbers is similar to the addition of two signed binary
numbers. But, we have to take 2’s complement of the number, which is supposed to be subtracted.
This is the advantage of 2’s complement technique. Follow, the same rules of addition of two
signed binary numbers.
Example 1
Let us perform the subtraction of two decimal numbers +7 and +4 using 2’s complement method.
17
The subtraction of these two numbers is
(+7)10−(+4)10=(+7)10+(−4)10
The 2’s complement representation of +7 and -4 with 5 bits each are shown below.
(+7)10=(00111)2
(+4)10=(11100)2
⇒(+7)10+(+4)10=(00111)2+(11100)2=(00011)2
Here, the carry obtained from sign bit. So, we can remove it. The resultant sum after removing
carry is
(+7)10+(+4)10=(00011)2
The sign bit ‘0’ indicates that the resultant sum is positive. So, the magnitude of it is 3 in decimal
number system. Therefore, subtraction of two decimal numbers +7 and +4 is +3.
Example 2
Let us perform the subtraction of two decimal numbers +4 and +7 using 2’s complement method.
(+4)10−(+7)10=(+4)10+(−7)10
The 2’s complement representation of +4 and -7 with 5 bits each are shown below.
(+4)10=(00100)2
(−7)10=(11001)2
⇒(+4)10+(−7)10=(00100)2+(11001)2=(11101)2
Here, carry is not obtained from sign bit. The sign bit ‘1’ indicates that the resultant sum
is negative. So, by taking 2’s complement of it we will get the magnitude of resultant sum as 3 in
decimal number system. Therefore, subtraction of two decimal numbers +4 and +7 is -3.
Base Conversions
What is Number System Conversion?
Number system conversion is a process of converting a number from one base to another. Number
system conversion is an important concept to represent information in different forms. In digital
electronics, the following number system conversions are mostly performed.
Let us understand each of these number system conversions with the help of examples.
In this method of binary to decimal conversion, each digit of the given binary number is multiplied
by its positional weight. Then, all the products are added to obtain the equivalent decimal number.
In the integer part, the remainders read from bottom to top give the integer part of the binary
equivalent. In the fractional part, the carries read from top to bottom give the fractional part of the
binary equivalent.
To convert the integer part of the given decimal number to octal, we divide the given decimal
number successively by 8 till the quotient is 0. The octal equivalent is obtained by reading the
remainders from bottom to top, where the last remainder will be the most significant digit.
To convert the fractional part of the given decimal number to octal, we multiply the given decimal
fraction successively by 8 till the product is 0 or the desired accuracy is obtained. The fractional
part of the equivalent octal number is obtained by reading the carries from top to bottom.
To convert the integer part, we successively divide the decimal integer by 16 till the quotient is 0.
The integer part of the equivalent hexadecimal is obtained by reading the remainders from bottom
to top.
To convert the fractional part, we multiply the decimal fractional number by 16 till the product is
0 or till the desired accuracy is obtained. The fractional part of the equivalent hexadecimal is
obtained by reading the carries from top to bottom.
20
The hexadecimal to octal conversion can be perform in the same way as the octal to hexadecimal
as explained above. To convert a given hexadecimal number to octal number, we first convert the
given hexadecimal number to binary and then the binary number to the octal.
In this method of binary to decimal conversion, each digit of the given binary number is multiplied
by its positional weight. Then, all the products are added to obtain the equivalent decimal number.
The step-by-step process of converting a binary number to its equivalent decimal number by using
positional weights method is explained below −
Step 3 − Add the product terms to obtain the equivalent decimal number.
Example 1
Convert (101101)2 into decimal equivalent.
Solution
The given binary number is (101101)2
Bits 1 0 1 1 0 1
Weights 25 24 23 22 21 20
1 25 1 × 32 32
0 24 0 × 16 0
21
1 23 1×8 8
1 22 1×4 4
0 21 0×2 0
1 20 1×1 1
Step 3 − Add all the product terms to obtain the equivalent decimal number −
Example 2
Convert (1111011)2 into decimal equivalent.
Solution
Multiplying Bits with positional weights, we get,
Decimal Number = 1 × 26 + 1 × 25 + 1 × 24 + 1 × 23 + 0 × 22 + 1 × 21 + 1 × 20
Example 3
Convert (1001.11)2 into decimal.
Solution
The given binary number has integer and fractional parts. The integer part is multiplied with
positive weights, while the fractional part is multiplied with negative weights as follows −
In the integer part, the remainders read from bottom to top give the integer part of the binary
equivalent. In the fractional part, the carries read from top to bottom give the fractional part of the
binary equivalent.
The following steps are followed to convert a decimal number to the binary equivalent −
Step 1 − Divide the integer part of the given decimal number successively by 2 and read the
remainders from bottom to top.
Step 2 − Multiply the fractional part of the given decimal number successively by 2 and read the
carries from top to bottom.
Let us see some examples to understand the conversion of a decimal number into its equivalent
binary number.
Example 1
Convert (28)10 to binary equivalent.
Solution
The given decimal number is an integer. Thus, we divide the decimal number successively by 2
and read the remainders upwards to obtain the equivalent binary number.
Decimal Remainders
2 28
2 14 0
2 7 0
2 3 1
2 1 1
0 1
Reading the remainders from bottom to top, the result will be (11100)2. It is the binary equivalent
of (28)10.
Example 2
23
Convert (165.75)10 to its equivalent binary.
Solution
The given decimal number is a mixed number having both integer and fractional parts. Thus, to
obtain its equivalent binary number, we convert the integer and fractional parts separately.
Decimal Remainders
2 165
2 82 1
2 41 0
2 20 1
2 10 0
2 5 0
2 2 1
2 1 0
0 1
Reading the remainders from bottom to top, the binary equivalent of 16510 is (10100101)2.
Now, let's convert the Fractional Part (0.75) of the given number.
0.75 × 2 1.5 1
0.5 × 2 1.0 1
0×2 0
Reading the carries from top to bottom, the result is 0.11. Thus, the binary equivalent of (0.75)10 is
(0.11)2.
Step 1 − Starting from the binary point, make groups of 3-bits on both sides of the binary point.
Step 2 − Replace each group of 3-bit binary by the equivalent octal digit.
The following table shows the equivalent octal digital for each 3-bit binary group −
Octal Binary
0 0 0 0
1 0 0 1
2 0 1 0
3 0 1 1
4 1 0 0
5 1 0 1
6 1 1 0
7 1 1 1
Let us understand the binary to octal conversion with the help of examples.
Example 1
Convert (110011101.110101)2 to its octal equivalent.
Solution
The binary to octal conversion will be performed as follows −
Octal Equivalent 6 3 5 . 6 5
25
Example 2
Convert (1110111011.11101)2 to octal equivalent.
Solution
The conversion of given binary number to octal number is given below −
Octal Equivalent 3 6 7 3 . 7 2
Let’s understand the conversion of octal number to binary equivalent with the help of examples.
Example 1
Convert (3572.126)8 to binary equivalent.
Solution
The given octal number is converted into binary equivalent as follows −
Octal Number 3 5 7 2 . 1 2 6
3-bit Binary Equivalent 011 101 111 010 . 001 010 110
Example 2
Convert (364.52)8 to its binary equivalent.
Solution
26
The conversion of given octal number to its equivalent binary number is given below −
Octal Number 3 6 4 . 5 2
The step-by-step procedure to convert an octal number to its equivalent decimal number is given
below −
Step 3 − Add the product terms to obtain the equivalent decimal number.
Let us understand the conversion of octal number to decimal number with the help of examples.
Example 1
Convert (356.25)8 to its decimal equivalent.
Solution
The given octal number can be converted to equivalent decimal number as follows −
5 (8)1 5 × (8)1 40
6 (8)0 6 × (8)0 6
. . . .
27
2 (8)-1 2 × (8)-1 0.25
Adding all the product terms to obtain the equivalent decimal number,
Example 2
Convert (527.322)8 to its decimal equivalent.
Solution
We can convert the given octal number to its equivalent decimal number as follows −
2 (8)1 2 × (8)1 16
7 (8)0 7 × (8)0 7
. . . .
To convert the integer part of the given decimal number to octal, we divide the given decimal
number successively by 8 till the quotient is 0. The octal equivalent is obtained by reading the
remainders from bottom to top, where the last remainder will be the most significant digit.
28
To convert the fractional part of the given decimal number to octal, we multiply the given decimal
fraction successively by 8 till the product is 0 or the desired accuracy is obtained. The fractional
part of the equivalent octal number is obtained by reading the carries from top to bottom.
Let’s understand the decimal to octal conversion with the help of examples.
Example
Convert (589.278)10 to octal.
Solution
The given decimal number is a mixed number with 589 as integer part and 0.278 as fractional part.
Thus, we first convert the integer part to octal and then we convert the fractional part to octal.
Decimal Remainders
8 589
8 73 5
8 9 1
8 1 1
0 1
Reading the remainders from bottom to top, the equivalent octal of (589)10 is (1115)8.
0.278 × 8 2.224 2
0.224 × 8 1.792 1
0.792 × 8 6.336 6
0.336 × 8 2.688 2
Reading the carries from top to bottom to obtain the fractional part of the equivalent octal number,
the result is (0.2162)8.
29
Hexadecimal to Binary Conversion
Hexadecimal to Binary Conversion
We can convert a hexadecimal number into its equivalent binary by using the mapping method. In
this method, we replace each digit of the given hexadecimal number by its equivalent 4-bit binary
group.
The following table shows the equivalent 4-bit binary group of each hexadecimal digit −
Hexadecimal Binary
0 0 0 0 0
1 0 0 0 1
2 0 0 1 0
3 0 0 1 1
4 0 1 0 0
5 0 1 0 1
6 0 1 1 0
7 0 1 1 1
8 1 0 0 0
9 1 0 0 1
A (10) 1 0 1 0
B (11) 1 0 1 1
C (12) 1 1 0 0
D (13) 1 1 0 1
E (14) 1 1 1 0
F (15) 1 1 1 1
Let us understand the conversion of a hexadecimal number to binary number with the help of
examples.
30
Example 1
Convert (3A94.C5D)16 to binary equivalent.
Solution
The given hexadecimal number can be converted into equivalent binary number as follows −
Hexadecimal Number 3 A 9 4 . C 5 D
3 10 9 4 . 12 5 13
4-bit Binary Equivalent 0011 1010 1001 0100 . 1100 0101 1101
Example 2
Convert (ABD.2E)16 to binary equivalent.
Solution
The conversion of given hexadecimal number to its binary is done as follows −
Hexadecimal Number A B D . 2 E
10 11 13 . 2 14
Let us understand the conversion of a binary number to its equivalent hexadecimal with the help of
examples.
31
Example 1
Convert (1110111001101.111011)2 to hexadecimal.
Solution
The conversion of the given binary number to hexadecimal equivalent is done as follows −
Hexadecimal Equivalent 1 D C D . E C
Example 2
Convert (110111110111.1100)2 to hexadecimal.
Solution
We can convert the given binary number into hexadecimal equivalent as follows −
Hexadecimal Equivalent D F 7 . C
The step-by-step procedure to convert a hexadecimal number to its equivalent decimal number is
explained below −
Step 3 − Add the product terms to obtain the equivalent decimal number.
32
Let us see some examples to understand the conversion of hexadecimal to decimal number.
Example 1
Convert (5AB2.8C)16 to decimal equivalent.
Solution
The conversion of the given hexadecimal number to its decimal equivalent is given below −
2 2 (16)0 2 × (16)0 2
. . . . .
Example 2
Convert (1AF.2)16 to decimal.
Solution
The decimal equivalent of the given hexadecimal number can be obtained as follows −
F 15 (16)0 15 × (16)0 15
. . . . .
33
2 2 (16)-1 2 × (16)-1 0.125
To convert the integer part, we successively divide the decimal integer by 16 till the quotient is 0.
The integer part of the equivalent hexadecimal is obtained by reading the remainders from bottom
to top.
To convert the fractional part, we multiply the decimal fractional number by 16 till the product is
0 or till the desired accuracy is obtained. The fractional part of the equivalent hexadecimal is
obtained by reading the carries from top to bottom.
Example
Convert (524.26)10 to hexadecimal.
Solution
The given decimal number is a mixed number. Hence, we have to convert its integer and fractional
parts separately.
Decimal Remainders
16 524
16 32 12 (C)
16 2 0
0 2
Reading the remainder from bottom to top to obtained the hexadecimal equivalent, the result is
(20C)16.
34
Converting Fractional Part (0.26)10 to Hexadecimal −
0.26 × 16 4.16 4
0.16 × 16 2.56 2
0.56 × 16 8.96 8
Reading the carries from top to bottom to obtain the equivalent hexadecimal number, the result is
(0.428F)16.
The step-by-step process to convert a given octal number to its equivalent hexadecimal is given
below −
Step 1 − Convert each digit of the given octal number to its equivalent binary of 3-bits.
Example 1
Convert (742.35)8 to hexadecimal.
Solution
The conversion of given octal number to hexadecimal is explained below −
7 111 0001 1
35
4 100 1110 E
2 010 0010 2
. . . .
3 011 0111 7
5 101 0100 4
Example 2
Convert (1523.742)8 to hexadecimal.
Solution
The following table demonstrates the conversion of given octal number to hexadecimal −
1 001 0000 0
5 101 0011 3
2 010 0101 5
3 011 0011 3
. . . .
7 111 1111 F
4 100 0001 1
2 010 0000 0
36
The step-by-step procedure to convert a hexadecimal number to its equivalent octal number is
explained below −
Step 3 − Convert each 3-bit binary group to its equivalent octal number.
The following examples demonstrate the method of converting a given hexadecimal number to its
equivalent octal number.
Example 1
Convert (B3A9.5F)16 to octal.
Solution
The conversion of the given hexadecimal number to its equivalent octal number is explained below
−
Hex Digits B 3 A 9 . 5 F
3-bit Binary 001 011 001 110 101 001 . 010 111 110
Octal Digits 1 3 1 6 5 1 . 2 7 6
Example 2
Convert (AC.F)16 to octal.
Solution
The conversion of given hexadecimal number to its equivalent octal number is demonstrated below
−
Hex Digits A C . F
10 12 . 15
37
Octal Digits 2 5 4 . 7 4
38