Lecture 02 Number Systems

Download as pdf or txt
Download as pdf or txt
You are on page 1of 38

Learning Objectives and Expected Learning Outcomes for Number Systems

Learning Objectives

By the end of the number systems topic, students will:

1. Understand the Fundamentals of Number Systems:


Gain a comprehensive understanding of various number systems such as binary,
decimal, octal, and hexadecimal.
2. Learn Binary Arithmetic Operations:
Master basic arithmetic operations in binary, including addition, subtraction,
multiplication, and division.
3. Develop Conversion Skills:
Learn how to convert numbers between different number systems accurately and
efficiently.
4. Understand the Role of Number Systems in Computing:
Appreciate how different number systems are used in computing to represent and
process data.
5. Apply Knowledge Practically:
Solve real-world computing problems that require manipulation and conversion of
number systems.

Expected Learning Outcomes

By the end of the topic, students will be able to:

1. Identify and Differentiate Number Systems:


Explain the structure and use of binary, decimal, octal, and hexadecimal systems.
2. Perform Binary Arithmetic:
Solve arithmetic problems using binary operations such as:
o Binary addition (e.g., 1010 + 1101 = 10111)
o Binary subtraction (e.g., 1010 - 0110 = 0100)
o Binary multiplication (e.g., 101 × 11 = 1111)
o Binary division (e.g., 1010 ÷ 10 = 101)
3. Convert Between Number Systems:
Accurately convert numbers between:
o Decimal to binary, octal, and hexadecimal.
o Binary to decimal, octal, and hexadecimal.
o Octal to binary, decimal, and hexadecimal.
o Hexadecimal to binary, octal, and decimal.
4. Understand Arithmetic Overflow in Binary:
Explain the concept of overflow in binary arithmetic and how it impacts computing
systems.
5. Use Number Systems in Applications:
Apply knowledge of number systems in real-world applications, such as:

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.

Types of Digital Number Systems


In digital electronics, the following four types of digital number systems are mainly used −

• Binary Number System


• Decimal Number System
• Octal Number System
• Hexadecimal Number System

Let’s discuss each of these number systems in detail.

Binary Number System


Binary number system is the fundamental building block behind the implementation and working
of all digital 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.

Mathematically, we can write it as,

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


Decimal number system is not inherently a digital number system. But it is widely used to represent
the digital information in a human readable format.

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.

Mathematically, we can write it as,

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.

Mathematically, we can write it as,

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.

Hexadecimal Number System


The hexadecimal number system is a base 16 number system. It has 16 digits, 0 to 9 and A to F.
Where, A represents 10, B represents 11, C represents 12, D represents 13, E represents 14, and F
represents 15. The hexadecimal number system is equivalent to a 4-bit binary number system as
24 = 16. Thus, the value of a hexadecimal number can be calculated by the sum of powers of 16.

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.

Advantages of Digital Number Systems


The following are some key advantages of digital number systems −

• 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.

Applications of Digital Number Systems


Digital number systems are used in various digital electronic fields such as computing, internet,
communication, signal processing, and more. Here are a few examples of applications of digital
number systems −

• Information Representation
• Digital Communication
• Storage and Transmission of Digital Data and Information
• Algorithm Development
• System Programming, etc.

Binary Numbers Representation


We can categorize binary numbers into two groups Unsigned numbers and Signed numbers.
Read this chapter to learn how signed and unsigned binary numbers are represented. We will also
explain how you can find out the 1's and 2's complement form of signed binary numbers.

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.

Representation of Un-Signed Binary Numbers

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.

Representation of Signed Binary Numbers


The Most Significant Bit (MSB) of signed binary numbers is used to indicate the sign of the
numbers. Hence, it is also called as sign bit. The positive sign is represented by placing ‘0’ in the
sign bit. Similarly, the negative sign is represented by placing ‘1’ in the sign bit.

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.

There are three types of representations for signed binary numbers

• 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

Therefore, the sign-magnitude representation of -108 is 11101100.

1’s complement form


The 1’s complement of a number is obtained by complementing all the bits of signed binary
number. So, 1’s complement of positive number gives a negative number. Similarly, 1’s
complement of negative number gives a positive number.

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

Therefore, the 1’s complement of (108)10 is (10010011)2.

2’s complement form


The 2’s complement of a binary number is obtained by adding one to the 1’s complement of
signed binary number. So, 2’s complement of positive number gives a negative number. Similarly,
2’s complement of negative number gives a positive number.

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.

We know the 1’s complement of (108)10 is (10010011)2

2’s compliment of (108)10 = 1’s compliment of (108)10 + 1.

= 10010011 + 1

= 10010100

Therefore, the 2’s complement of (108)10 is (10010100)2.

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.

Rules of Binary Addition


The addition of two binary numbers is performed according to these rules of binary arithmetic −

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).

Write the end around carry 1 in the sum.

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).

Hence, the sum of 1010 and 11011 is 100101.

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.

Also, a borrow bit can be taken from higher bits if require.

Rules of Binary Subtraction

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 −

1101 – 1100 = 0001

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.

Thus, the difference of 1101 and 1100 is 0001.

Example 2
Subtract 101 from 1111.

Solution
11
The subtraction of given binary numbers is explained below −

Explanation
Subtract rightmost bits: 1 – 1 = 0

Subtract second rightmost bits: 1 – 1 = 1

Subtract third rightmost bits: 1 – 1 = 0

Subtract leftmost bits: 1 – 0 = 1

Thus, the result is 1010.

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.

Subtract third rightmost bits: 0 – 0 = 0. The 1 borrow is given to previous bit.

Subtract leftmost bits: 1 – 1 = 0.

Thus, the difference of 1101 and 1011 is 0010.

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.

Rules of Binary Multiplication


The multiplication of two binary numbers is performed as per the following rules of binary
arithmetic −

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.

Hence, the product of 1101 and 11 is 100111.

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).

Shift the partial product one position to the left.

Multiply the second rightmost bit of the second number (1) by each bit of the first binary number
(11011).

Again, shift the partial product one position to the left.

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.

Hence, the product of 11011 and 110 is 10100010.

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.

Rules of Binary Division


The following rules of binary arithmetic are utilized while diving one binary number by another −

0÷0=Undefined0
0÷1=0

14
1÷0=Undefined
1÷1=1withRemainder=0

Binary Division Procedure


• Start dividing from the leftmost bits of the dividend by the divisor.
• Multiply the quotient obtained by the divisor and subtract from the dividend.
• Bring down the next bits of the dividend and repeat the division process until all the bits of
given divided are used.

Let us consider some solved examples to understand the binary division.

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.

Signed Binary Arithmetic


In this chapter, let us discuss about the basic arithmetic operations, which can be performed on any
two signed binary numbers using 2’s complement method. The basic arithmetic operations are
addition and subtraction.

Addition of two Signed Binary Numbers


Consider the two signed binary numbers A & B, which are represented in 2’s complement form.
We can perform the addition of these two numbers, which is similar to the addition of two
unsigned binary numbers. But, if the resultant sum contains carry out from sign bit, then discard
(ignore) it in order to get the correct value.

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

Resultant sum after removing carry is (−7)10 + (−4)10 = (10101)2.

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.

Subtraction of two Signed Binary Numbers


Consider the two signed binary numbers A & B, which are represented in 2’s complement form.
We know that 2’s complement of positive number gives a negative number. So, whenever we have
to subtract a number B from number A, then take 2’s complement of B and add it to A.
So, mathematically we can write it as

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.

The subtraction of these two numbers is

(+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.

• Binary to Decimal Conversion


18
• Decimal to Binary Conversion
• Binary to Octal Conversion
• Octal to Binary Conversion
• Octal to Decimal Conversion
• Decimal to Octal Conversion
• Hexadecimal to Binary Conversion
• Binary to Hexadecimal Conversion
• Hexadecimal to Decimal Conversion
• Decimal to Hexadecimal Conversion
• Octal to Hexadecimal Conversion
• Hexadecimal to Octal Conversion

Let us understand each of these number system conversions with the help of examples.

Binary to Decimal Conversion


We can convert a binary number into its equivalent decimal number by using the positional weights
method.

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.

Decimal to Binary Conversion


A decimal number can be converted to their equivalent binary number by using the double-dabble
method. In this method, the integer part of the given decimal number is successively divided by 2
and the fractional part is successively multiplied by 2.

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.

Binary to Octal Conversion


A binary number can be converted into its equivalent octal number by mapping method.

Octal to Binary Conversion


We can also use the mapping method to convert an octal number into its equivalent binary number.
In this method, we just replace each digital of the given octal number by its 3-bit binary equivalent.

Octal to Decimal Conversion


The conversion of an octal number to its equivalent decimal number is same as the binary to
decimal conversion. To convert an octal number to its decimal equivalent, we multiply each digit
of the octal number by its positional weight and then add all the product terms to obtain the
equivalent decimal number.

Decimal to Octal Conversion


19
We can convert a mixed decimal number (having integer and fractional parts) to its equivalent octal
number. For this, we convert the integer and fractional parts separately.

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.

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.

Binary to Hexadecimal Conversion


To convert a given binary number to its equivalent hexadecimal number, we create groups of 4 bits
each on both sides of the binary point. Then, we replace each group of 4-bit binary by the equivalent
hexadecimal digit.

Hexadecimal to Decimal Conversion


To convert a hexadecimal number to its equivalent decimal number, we multiply each digit in the
hexadecimal number by its positional weight and then add all the product terms to obtain the final
result.

Decimal to Hexadecimal Conversion


If a mixed decimal number is given that has integer and fraction parts. Then, to convert the given
decimal number to its equivalent hexadecimal, we convert integer and fraction parts separately.

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.

Octal to Hexadecimal Conversion


The conversion of octal to hexadecimal is very simple. We first convert the given octal number to
binary and then the binary number to the hexadecimal.

Hexadecimal to Octal Conversion

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.

Binary to Decimal Conversion


Binary to Decimal Conversion
We can convert a binary number into its equivalent decimal number by using the positional weights
method.

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 1 − Write the positional weights for each binary digit.

Step 2 − Multiply each binary digit with its positional weight.

Step 3 − Add the product terms to obtain the equivalent decimal number.

Let us consider some examples to understand the binary to decimal conversion.

Example 1
Convert (101101)2 into decimal equivalent.

Solution
The given binary number is (101101)2

Step 1 − Defining positional weights for the given binary number −

Bits 1 0 1 1 0 1

Weights 25 24 23 22 21 20

Step 2 − Calculating product of bits and positional weights −

Bits Weights Multiply Product

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 −

Decimal Number = 32 + 0 + 8 + 4 + 0 + 1 = (45)10

Hence, the decimal equivalent of (101101)2 is (45)10.

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

Decimal Number = 64 + 32 + 16 + 8 + 0 + 2 + 1 = (123)10

Hence, the decimal equivalent of (1111011)2 is (123)10.

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 −

Decimal Number = 1 × 23 + 0 × 22 + 0 × 21 + 1 × 20 + 1 × 2-1 + 1 × 2-2

Decimal Number = 8 + 0 + 0 + 1 + 0.5 + 0.25 = (9.75)10

Thus, the decimal equivalent of (1001.11)2 is (9.75)10.

Decimal to Binary Conversion


Decimal to Binary Conversion
22
A decimal number can be converted to their equivalent binary number by using the double-dabble
method. In this method, the integer part of the given decimal number is successively divided by 2
and the fractional part is successively multiplied by 2.

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.

The binary equivalent of 16510 is obtained as follows,

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.

To convert the given decimal fraction into binary, we multiply it by 2, as follows,

Decimal Product Carry

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.

Therefore, (165.75)10 = (10100101.11)2

Binary to Octal Conversion


24
Binary to Octal Conversion
A binary number can be converted into its equivalent octal number by mapping method. The
conversion of a binary number to the octal equivalent is done as per the following steps −

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

(2)2 = 4 (2)1 = 2 (2)0 = 1

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 −

3-bit Group 110 011 101 . 110 101

Octal Equivalent 6 3 5 . 6 5

Hence, the octal equivalent of given binary number is (635.65)8.

25
Example 2
Convert (1110111011.11101)2 to octal equivalent.

Solution
The conversion of given binary number to octal number is given below −

3-bit Group 1 110 111 011 . 111 01

011 110 111 011 . 111 010

Octal Equivalent 3 6 7 3 . 7 2

Hence, the octal equivalent of (1110111011.11101)2 is (3673.72)8.

Octal to Binary Conversion


Octal to Binary Conversion
We can also use the mapping method to convert an octal number into its equivalent binary number.
In this method, we just replace each digital of the given octal number by its 3-bit binary equivalent.

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

Hence, the binary equivalent of (3572.126)8 is (011101111010.001010110)2.

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

3-bit Binary Equivalent 011 110 100 . 101 010

Thus, the binary equivalent of the octal number (364.52)8 is (011110100.101010)2.

Octal to Decimal Conversion


Octal to Decimal Conversion
The conversion of an octal number to its equivalent decimal number is same as the binary to
decimal conversion. To convert an octal number to its decimal equivalent, we multiply each digit
of the octal number by its positional weight and then add all the product terms to obtain the
equivalent decimal number.

The step-by-step procedure to convert an octal number to its equivalent decimal number is given
below −

Step 1 − Write the positional weights for each octal digit.

Step 2 − Multiply each octal digit with its positional weight.

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 −

Octal Digits Positional Weights Multiply Product

3 (8)2 3 × (8)2 192

5 (8)1 5 × (8)1 40

6 (8)0 6 × (8)0 6

. . . .

27
2 (8)-1 2 × (8)-1 0.25

5 (8)-2 5 × (8)-2 0.078

Adding all the product terms to obtain the equivalent decimal number,

(356.25)8 = 192 + 40 + 6 + 0.25 + 0.078 = (238.328)10

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 −

Octal Digits Positional Weights Multiply Product

5 (8)2 5 × (8)2 320

2 (8)1 2 × (8)1 16

7 (8)0 7 × (8)0 7

. . . .

3 (8)-1 3 × (8)-1 0.375

2 (8)-2 2 × (8)-2 0.0313

2 (8)-3 2 × (8)-3 0.004

Add all the product terms to obtain the result,

(527.322)8 = 320 + 16 + 7 + 0.375 + 0.0313 + 0.004 = (343.4103)10

Decimal to Octal Conversion


Decimal to Octal Conversion
We can convert a mixed decimal number (having integer and fractional parts) to its equivalent octal
number. For this, we convert the integer and fractional parts separately.

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.

Converting Integer Part (589)10 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.

Converting the Fractional Part (0.278)10 to Octal −

Decimal Product Carry

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.

Thus, the equivalent octal number of (589.278)10 is (1115.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

(2)3 = 8 (2)2 = 4 (2)1 = 2 (2)0 = 1

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

Thus, the binary equivalent of the given hexadecimal number is


(0011101010010100.110001011101)2.

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

4-bit Binary Equivalent 1010 1011 1101 . 0010 1110

Hence, the equivalent binary of (ABD.2E)16 is (101010111101.00101110)2.

Binary to Hexadecimal Conversion


Binary to Hexadecimal Conversion
To convert a given binary number to its equivalent hexadecimal number, we create groups of 4 bits
each on both sides of the binary point. Then, we replace each group of 4-bit binary by the equivalent
hexadecimal digit.

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 −

4-bit Group 1 1101 1100 1101 . 1110 11

0001 1101 1100 1101 . 1110 1100

Hexadecimal Equivalent 1 D C D . E C

Thus, the hexadecimal equivalent of the given binary number is (1DCD.EC)16.

Example 2
Convert (110111110111.1100)2 to hexadecimal.

Solution
We can convert the given binary number into hexadecimal equivalent as follows −

4-bit Group 1101 1111 0111 . 1100

Hexadecimal Equivalent D F 7 . C

Thus, the hexadecimal equivalent of (110111110111.1100)2 is (DF7.C)16.

Hexadecimal to Decimal Conversion


Hexadecimal to Decimal Conversion
To convert a hexadecimal number to its equivalent decimal number, we multiply each digit in the
hexadecimal number by its positional weight and then add all the product terms to obtain the final
result.

The step-by-step procedure to convert a hexadecimal number to its equivalent decimal number is
explained below −

Step 1 − Write the positional weights for each hexadecimal digit.

Step 2 − Multiply each hexadecimal digit with its positional weight.

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 −

Hex Digits Decimal Equiv. Positional Weights Multiply Product

5 5 (16)3 5 × (16)3 20480

A 10 (16)2 10 × (16)2 2560

B 11 (16)1 11 × (16)1 176

2 2 (16)0 2 × (16)0 2

. . . . .

8 8 (16)-1 8 × (16)-1 0.5

C 12 (16)-2 12 × (16)-2 0.0468

Add all the product terms to obtain the equivalent decimal,

(5AB2.8C)16 = 20480 + 2560 + 176 + 2 + 0.5 + 0.0468 = (23218.5468)10

Example 2
Convert (1AF.2)16 to decimal.

Solution
The decimal equivalent of the given hexadecimal number can be obtained as follows −

Hex Digits Decimal Equiv. Positional Weights Multiply Product

1 1 (16)2 1 × (16)2 256

A 10 (16)1 10 × (16)1 160

F 15 (16)0 15 × (16)0 15

. . . . .

33
2 2 (16)-1 2 × (16)-1 0.125

Adding the product terms to obtain the equivalent decimal number,

(1AF.2)16 = 256 + 160 + 15 + 0.125 = (431.125)10

Decimal to Hexadecimal Conversion


Decimal to Hexadecimal Conversion
If a mixed decimal number is given that has integer and fraction parts. Then, to convert the given
decimal number to its equivalent hexadecimal, we convert integer and fraction parts separately.

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.

Let us see some examples to understand the decimal to hexadecimal conversion.

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.

Converting Integer Part (524)10 to Hexadecimal −

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 −

Decimal Product Carry

0.26 × 16 4.16 4

0.16 × 16 2.56 2

0.56 × 16 8.96 8

0.96 × 16 15.36 15 (F)

Reading the carries from top to bottom to obtain the equivalent hexadecimal number, the result is
(0.428F)16.

Thus, the hexadecimal equivalent of the decimal number (524.26)10 is (20C.428F)16.

Octal to Hexadecimal Conversion


Octal to Hexadecimal Conversion
The conversion of octal to hexadecimal is very simple. We first convert the given octal number to
binary and then the binary number to the hexadecimal.

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.

Step 2 − Make groups of 4 bits each of the obtained binary number.

Step 3 − Convert each 4-bit binary group to its equivalent hexadecimal.

Let us see some examples to understand the conversion of octal to hexadecimal.

Example 1
Convert (742.35)8 to hexadecimal.

Solution
The conversion of given octal number to hexadecimal is explained below −

Octal Digits 3-bit Binary 4-bit Binary Hex Digits

7 111 0001 1

35
4 100 1110 E

2 010 0010 2

. . . .

3 011 0111 7

5 101 0100 4

Thus, the hexadecimal equivalent of the given octal number is (1E2.74)16.

Example 2
Convert (1523.742)8 to hexadecimal.

Solution
The following table demonstrates the conversion of given octal number to hexadecimal −

Octal Digits 3-bit Binary 4-bit Binary Hex Digits

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

Hence, the hexadecimal equivalent of the given octal number is (353.F1)16.

Hexadecimal to Octal Conversion


Hexadecimal to Octal Conversion
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.

36
The step-by-step procedure to convert a hexadecimal number to its equivalent octal number is
explained below −

Step 1 − Convert each hexadecimal digit to its equivalent 4-bit binary.

Step 2 − Make groups of 3-bits each of the obtained binary number.

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

4-bit Binary 1011 0011 1010 1001 . 0101 1111

3-bit Binary 001 011 001 110 101 001 . 010 111 110

Octal Digits 1 3 1 6 5 1 . 2 7 6

Thus, the octal equivalent of the given hexadecimal number is (131651.276)8.

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

4-bit Binary 1010 1100 . 1111

3-bit Binary 010 101 100 . 111 100

37
Octal Digits 2 5 4 . 7 4

Hence, the octal equivalent of the given hexadecimal number is (254.74)8.

38

You might also like