0% found this document useful (0 votes)
43 views25 pages

Number Systems

This document covers the fundamentals of number systems, detailing both non-positional and positional systems, including popular types such as decimal, binary, octal, and hexadecimal. It explains the concepts of conversion between these systems, binary addition and subtraction, and the significance of digits in various bases. Additionally, it provides methods for converting decimal numbers to other bases and vice versa, along with examples for clarity.

Uploaded by

Vandana Vijayan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views25 pages

Number Systems

This document covers the fundamentals of number systems, detailing both non-positional and positional systems, including popular types such as decimal, binary, octal, and hexadecimal. It explains the concepts of conversion between these systems, binary addition and subtraction, and the significance of digits in various bases. Additionally, it provides methods for converting decimal numbers to other bases and vice versa, along with examples for clarity.

Uploaded by

Vandana Vijayan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 25

S1BCA DIGITAL FUNDAMENTALS NUMBER SYSTEM

MODULE 1
UNIT 1.1-Number Systems, Introduction – Base or radix, Non-positional and Positional number
system, Popular number systems (Decimal, Binary, Octal and Hexadecimal), Conversion-From
one number system to another, Concept of binary addition and subtraction, 1’s Complement,
2’s complement.

Number Systems

A number system (or numeral system) defines how a number can be represented using distinct
symbols. Each symbol in the number is called a digit. The leftmost digit in any number representation,
which has the greatest positional weight out of all the digits present in that number, is called the most
significant digit (MSD) and the rightmost digit, which has the least positional weight out of all the
digits present in that number, is called the least significant digit (LSD). A number can be
represented differently in different systems. The digits on the left side of the radix point form the
integer part of a number and those on the right side form the fractional part.

(𝑵)𝒓
=

𝑵 = a number and 𝒓 = radix or base of number system

In general, a number expressed in base-r system has coefficients multiplied by powers of r:


𝐴𝑛−1𝑟𝑛−1 + 𝐴𝑛−2𝑟𝑛−2 + ⋯ + 𝐴1𝑟1 + 𝐴0𝑟0 + 𝐴−1𝑟−1 + 𝐴−2𝑟−2 + ⋯ + 𝐴−𝑚𝑟−𝑚

Radix Point: Radix point is a base point used to separate the integer part and the fractional part of a
number.

A number can be represented differently in different systems.

1 | Page
S1BCA DIGITAL FUNDAMENTALS NUMBER SYSTEM

Number systems are classified into:


(a) Non-Positional Number System
(b) Positional Number System

(A)Non- Positional Number System

Non-positional number system is also known as non-weighted number system. Digit


value is independent of its position. Non-positional number system is used for shift position
encodes and error detecting purpose. Few examples of non-weighted number system are
gray code, roman code, excess-3 code, etc.

(B)Positional Number System

Positional number system is the type of number system in which the weight or value of the
digit (or symbol) depends upon its position in the number. The positional number system is
also known as weighted number system.
There are four very popular positional number systems, which are:

1. Decimal number system:


- The decimal number system contains ten unique digits from 0 to 9.
- The base or radix is 10.

2. Binary number system:


- The binary number system contains two unique digits 0 and 1.
- The base or radix is 2.

3. Octal number system:


- The octal number system contains eight unique digits from 0 to 7.
- The base or radix is 8.

4. Hexadecimal number system:


- The hexadecimal number system contains sixteen unique digits: 0 to 9 and six
letters A, B, C, D, E and F.
- The base or radix is 16.

Base or radix: The number of symbols used in a number system is called base or radix of the
number system.
Eg: In decimal number system – Base is 10
In Binary number system – Base is 2
In Hexadecimal number system – Base is 16 etc

Most significant bit (MSB): The left most bit of a binary number which has the highest place
value is called most significant bit.
Least significant bit (LSB): The right most bit of a binary number which has the least place
value is called least significant bit.
Bit: A binary digit is called a bit. Example: 0 or 1

Nibble: A group of four bits is called a Nibble. Example: 0110, 1110 etc.

Byte: A group of eight bits is called a byte. Example: 01101101, 11010011 etc.

2 | Page
S1BCA DIGITAL FUNDAMENTALS NUMBER SYSTEM

NUMBER BASE CONVERSION

3 | Page
S1BCA DIGITAL FUNDAMENTALS NUMBER SYSTEM

Decimal Number System

The decimal number system contains ten digits from 0 to 9(base 10). Here, the successive
place value or position, left to the decimal point holds units, tens, hundreds, thousands, and so on. The
position in the decimal number system specifies the power of the base (10). The 0 is the minimum
value of the digit, and 9 is the maximum value of the digit.

The decimal number can be an integer or floating-point integer. When the decimal number is a
floating-point 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 ′𝒓’.

Conversion of Integer part:


- Divide the given integer part of decimal number by base ′𝒓′ successively and write
down all the remainders till the quotient is zero.
- Write all the remainders starting with the MSB (Most Significant Bit) i.e. from
bottom to LSB (Least Significant Bit) i.e. top.

Conversion of Fractional part:


- Multiply the given fractional part of decimal number by base ′𝒓′ successively
until the fractional part becomes zero.
- Note down the integer part starting from first.
Note: If fractional part does not become zero then, result has been taken up to 6 places.

 Decimal to Binary Conversion


The decimal integer number is converted to the binary integer number by successive division
by 2, and the decimal fraction is converted to binary fraction by successive multiplication by 2. This is
also known as the double-dabble method. In the successive division-by-2 method, the given decimal
integer number is successively divided by 2 till the quotient is zero. The last remainder is the MSB.
The remainders read from bottom to top give the equivalent binary integer number.

In the successive multiplication-by-2 method, the given decimal fraction and the subsequent
decimal fractions are successively multiplied by 2, till the fraction part of the product is 0 or till the
desired accuracy is obtained. The first integer obtained is the MSB. Thus, the integers read from top to
bottom give the equivalent binary fraction. To convert a mixed number to binary, convert the integer
and fraction parts separately to binary and then combine them.

For converting decimal to binary, there are two steps required to perform, which are as follows:

1. In the first step, we perform the division operation on the integer and the successive quotient
with the base of binary(2).
2. Next, we perform the multiplication on the integer and the successive quotient with the base of
binary(2).

4 | Page
S1BCA DIGITAL FUNDAMENTALS NUMBER SYSTEM

1. Convert (𝟓𝟏) and (𝟏𝟓𝟐) into binary.


2 152
2 51 2 76 0 (LSB)
2 25 1 (LSB) 2 38 0
2 12 1 2 19 0
2 6 0 2 9 1
2 3 0 2 4 1
2 1 1 2 2 0
0 1 (MSB) 2 1
(51)10 = (110011)2
0
0 1 (MSB)
(152)10 = (10011000)2

2. Convert (𝟒𝟏. 𝟔𝟖𝟕𝟓) into binary.


Conversion of integer part:
3.
Conversion of fractional part:
2 41 integer fraction
2 20 1 (LSB) 0.6875×2 1 0.3750
2 10 0.3750×2 0 0.7500
0
2 5 0.7500×2 1 0.5000
0
0.5000×2 1 0.0000
2 2 1
2 1 0
0 1 (MSB)

(41)10 = (101001)2 (0.6875)10 = (0.1011)2

∴ (𝟒𝟏. 𝟔𝟖𝟕𝟓)𝟏𝟎 = (𝟏𝟎𝟏𝟎𝟎𝟏. 𝟏𝟎𝟏𝟏)𝟐

 Decimal to Octal Conversion

For converting decimal to octal, there are two steps required to perform, which are as follows:

1. In the first step, we perform the division operation on the integer and the successive quotient
with the base of octal (8).

5 | Page
S1BCA DIGITAL FUNDAMENTALS NUMBER SYSTEM

2. Next, we perform the multiplication on the integer and the successive quotient with the base of
octal (8).

1. Convert (𝟏𝟐𝟓) into octal.


8 125
8 15 5 (LSB)
8 1 7
0 1 (MSB)

(125)10 = (175)8

2.Convert (𝟏𝟓𝟑. 𝟓𝟏𝟑) into octal.


Conversion of integer part: Conversion of fractional part:
8 153 integer fraction
8 19 1 (LSB) 0.513×8 4 0.104
8 2 3 0.104×8 0 0.832
0.832×8 6 0.656
0 2 (MSB)
0.656×8 5 0.248
(153)10 = (231)8
0.248×8 1 0.984
0.948×8 7 0.584

(0.513)10 =
(0.406517)8
∴ (𝟏𝟓𝟑. 𝟓𝟏𝟑)𝟏𝟎 = (𝟐𝟑𝟏. 𝟒𝟎𝟔𝟓𝟏𝟕)𝟖

3. Convert (𝟏𝟐𝟓. 𝟔𝟖𝟕𝟓) to octal.


Conversion of integer part: Conversion of fractional part:
integer fraction
8 125
0.6875×8 5 0.5000
8 15 5 (LSB)
0.5000×8 4 0.0000
8 1 7
0 1 (MSB)

(125)10 = (175)8 (0.6875)10 = (54)8

∴ (𝟏𝟐𝟓. 𝟔𝟖𝟕𝟓)𝟏𝟎 = (𝟏𝟕𝟓. 𝟓𝟒)𝟖

 Decimal to Hexadecimal Conversion

For converting decimal to hexadecimal, there are two steps required to perform, which are as follows:

1. In the first step, we perform the division operation on the integer and the successive quotient
with the base of hexadecimal (16).
2. Next, we perform the multiplication on the integer and the successive quotient with the base of
hexadecimal (16).

6 | Page
S1BCA DIGITAL FUNDAMENTALS NUMBER SYSTEM

1. Convert (𝟐𝟓𝟗𝟖) to hexadecimal..


16 2598
16 162 6 (LSB)
16 10 2
0 10(A) (MSB)

(2598)10 = (𝐴26)16

2.Convert (𝟗𝟓𝟐. 𝟔𝟐) to hexadecimal.


Conversion of integer part: Conversion of fractional part:
16 952 integer fraction
16 59 8 (LSB) 0.62×16 9 0.92
16 3 11(B) 0.92×16 14(E) 0.72
0.72×16 11(B) 0.52
0 3 (MSB)
0.52×16 8 0.32
(952)10 = (3𝐵8)16
0.32×16 5 0.12
0.12×16 1 0.92

(0.513)10 = (0.9𝐸𝐵851)16
∴ (𝟗𝟓𝟐. 𝟔𝟐)𝟏𝟎 = (𝟑𝑩𝟖. 𝟗𝑬𝑩𝟖𝟓𝟏)𝟏𝟔

Any Base to Decimal Conversion


Converting from any base to decimal is done by multiplying each digit by its corresponding positional
weights and summing.
 Binary to Decimal
Binary numbers may be converted to their decimal equivalents by the positional weights method. In
this method, each binary digit of the number is multiplied by its position weight and the product
terms are added to obtain the decimal number

1. Convert (𝟏𝟎𝟏𝟏𝟎) into decimal.

(10110)2 = 1 × 24 + 0 × 23 + 1 × 22 + 1 × 21 + 0 × 20
= 16 + 0 + 4 + 2 + 0
= 22
∴ (𝟏𝟎𝟏𝟏𝟎)𝟐 = (𝟐𝟐)𝟏𝟎

2. Convert (𝟏𝟏𝟎𝟏. 𝟎𝟏𝟏) into decimal.

(1101.011)2 = 1 × 23 + 1 × 22 + 0 × 21 + 1 × 20 + 0 × 2−1 + 1 × 2−2 + 1


× 2−3
= 8 + 4 + 0 + 1 + 0 + 0.25 + 0.125
= 13.375
∴ (𝟏𝟏𝟎𝟏. 𝟎𝟏𝟏)𝟐 = (𝟏𝟑. 𝟑𝟕𝟓)𝟏𝟎

7 | Page
S1BCA DIGITAL FUNDAMENTALS NUMBER SYSTEM

 Octal to Decimal

The 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 hexadecimal to decimal.

1. Convert (𝟕𝟐𝟒. 𝟐𝟓) into decimal.

(724.25)8 = 7 × 82 + 2 × 81 + 4 × 80 + 2 × 8−1 + 5 × 8−2


= 448 + 18 + 4 + 0.25 + 0.0781
= 470.3281
∴ (𝟕𝟐𝟒. 𝟐𝟓)𝟖 = (𝟒𝟕𝟎. 𝟑𝟐𝟖𝟏 )𝟏𝟎

2. Convert (𝟔𝟑𝟎𝟏) into decimal.


(6301)8 = 6 × 83 + 3 × 82 + 0 × 81 + 1 × 80
= 3072 + 192 + 0 + 1
= 3265
∴ (𝟔𝟑𝟎𝟏)𝟖 = (𝟑𝟐𝟔𝟓 )𝟏𝟎

 Hexadecimal to Decimal

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

1. Convert (𝑨𝟎𝑭𝟗. 𝟎𝑬𝑩) to decimal.


(𝐴0𝐹9.0𝐸𝐵)16
= 10 × 163 + 0 × 162 + 15 × 161 + 9 × 160 + 0 × 16−1 + 14
× 16−2 + 11 × 16−3
= 40960 + 0 + 240 + 9 + 0 + 0.0546 + 0.0026
= 41209.0572
∴ (𝑨𝟎𝑭𝟗. 𝟎𝑬𝑩)𝟏𝟔 = (𝟒𝟏𝟐𝟎𝟗. 𝟎𝟓𝟕𝟐 )𝟏𝟎

Binary Number System


The binary number system is a positional weighted system. The base or radix of this number system
is 2. Hence, it has two independent symbols.. The symbols used are 0 and 1. A binary digit is called a
bit. A binary number consists of a sequence of bits, each of which is either a 0 or a 1. The binary point

8 | Page
S1BCA DIGITAL FUNDAMENTALS NUMBER SYSTEM

separates the integer and fraction parts. Each digit (bit) carries a weight based on its position relative
to the binary point.

A four-bit collection (1101) is known as a nibble, and a collection of eight bits (11001010) is known as
a byte. The location of a digit in a binary number represents a specific power of the base (2) of the
number system.

Characteristics:

1. It holds only two values, i.e., either 0 or 1.


2. It is also known as the base 2 number system.
3. The position of a digit represents the 0 power of the base(2). Example: 20
4. The position of the last digit represents the x power of the base(2). Example: 2 x, where x
represents the last position, i.e., 1

Examples:

(10100)2, (11011)2, (11001)2, (000101)2, (011010)2.

 Binary to Octal and Hexadecimal Numbers

o Binary to Octal
As 8 = 23, for binary to octal conversion groups of 3 binary bits each are formed in the
binary number. After forming groups, each group of three binary bits is converted to its octal
equivalent.

- For integer part of the binary number, the group of three bits is formed from right to left. In
the binary fraction the group of three bits is formed from left to right. If there are not 3 bits available
at last, just stuff ‘0’ to make 3 bits group.

1. Convert (𝟏𝟎𝟏𝟏𝟎𝟎𝟎𝟏𝟏𝟎𝟏𝟎𝟏𝟏. 𝟏𝟏𝟏𝟏𝟎𝟎𝟎𝟎𝟎𝟏𝟏𝟎) into octal.

(10110001101011.111100000110)2 = 010 110 001 101 011. 111 100 000


110
= 2 6 1 5 3 . 7 4 0 6

∴ (𝟏𝟎𝟏𝟏𝟎𝟎𝟎𝟏𝟏𝟎𝟏𝟎𝟏𝟏. 𝟏𝟏𝟏𝟏𝟎𝟎𝟎𝟎𝟎𝟏𝟏𝟎)𝟐 = (𝟐𝟔𝟏𝟓𝟑. 𝟕𝟒𝟎𝟔)𝟖


= 26153.7406

2. Convert (𝟏𝟏𝟎𝟏𝟎𝟏. 𝟏𝟎𝟏𝟎𝟏𝟎) into octal.

(110101.101010)2 = 110 101 . 101 010


= 6 5 . 5 2
= 65.52

∴ (𝟏𝟏𝟎𝟏𝟎𝟏. 𝟏𝟎𝟏𝟎𝟏𝟎)𝟐 = (𝟔𝟓. 𝟓𝟐)𝟖

 Binary to Hexadecimal

As 16 = 24, for binary to hexadecimal conversion groups of 4 binary bits each are formed in the binary
number. After forming groups, each group of four binary bits is converted to its hexadecimal

9 | Page
S1BCA DIGITAL FUNDAMENTALS NUMBER SYSTEM

equivalent.

For integer part of the binary number, the group of 4 bits is formed from right to left. In the
binary fraction the group of 4 bits is formed from left to right. If there are not 4 bits available at last,

1. Convert (𝟏𝟎𝟏𝟏𝟎𝟎𝟎𝟏𝟏𝟎𝟏𝟎𝟏𝟏. 𝟏𝟏𝟏𝟏𝟎𝟎𝟎𝟎𝟎𝟏𝟏𝟎) into hexadecimal.


just stuff ‘0’ to make 4 bits group.

(10110001101011.111100000110)2 = 0010 1100 0110 1011. 1111


0000 0110
= 2 C 6 B F 0 6
= 2C6B.F06

∴ (𝟏𝟎𝟏𝟏𝟎𝟎𝟎𝟏𝟏𝟎𝟏𝟎𝟏𝟏. 𝟏𝟏𝟏𝟏𝟎𝟎𝟎𝟎𝟎𝟏𝟏𝟎) = (2C6B. F06)

Octal Number System

The octal number system has base 8(means it has only eight digits from 0 to 7). There are only eight
possible digit values to represent a number. With the help of only three bits, an octal number is
represented. Each set of bits has a distinct value between 0 and 7

Below, we have described certain characteristics of the octal number system:

Characteristics:

1. An octal number system carries eight digits starting from 0, 1, 2, 3, 4, 5, 6, and 7.


2. It is also known as the base 8 number system.
3. The position of a digit represents the 0 power of the base(8). Example: 80
4. The position of the last digit represents the x power of the base(8). Example: 8 x, where x
represents the last position, i.e., 1

Examples:
(273)8, (5644)8, (0.5365)8, (1123)8, (1223)8.

 Octal to Hexadecimal

For converting octal to hexadecimal, there are two steps required to perform, which are as follows:

1. In the first step, we will find the binary equivalent of number.


2. Next, we have to make the pairs of four bits on both sides of the binary point. If there will be
one, two, or three bits left in a pair of four bits pair, we add the required number of zeros on
extreme sides and write the hexadecimal digits corresponding to each pair.

Eg:

10 | Page
S1BCA DIGITAL FUNDAMENTALS NUMBER SYSTEM

Example 1: (152.25)8

Step 1:We write the three-bit 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 two-digit. 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

 Octal to Binary

The 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 three-bit 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

Hexadecimal Number System

11 | Page
S1BCA DIGITAL FUNDAMENTALS NUMBER SYSTEM

It is another technique to represent the number in the digital system called the hexadecimal number
system. The number system has a base of 16 means there are total 16 symbols(0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
A, B, C, D, E, F) used for representing a number. The single-bit representation of decimal values10, 11,
12, 13, 14, and 15 are represented by A, B, C, D, E, and F. Only 4 bits are required for representing a
number in a hexadecimal number. Each set of bits has a distinct value between 0 and 15. There are the
following characteristics of the octal number system:

Characteristics:

1. It has ten digits from 0 to 9 and 6 letters from A to F.


2. The letters from A to F defines numbers from 10 to 15.
3. It is also known as the base 16number system.
4. In hexadecimal number, the position of a digit represents the 0 power of the base(16).
Example: 160
5. In hexadecimal number, the position of the last digit represents the x power of the base(16).
Example: 16x, where x represents the last position, i.e., 1

 Hexadecimal to Octal

For converting hexadecimal to octal, there are two steps required to perform, which are as follows:

1. In the first step, we will find the binary equivalent of the hexadecimal number.
2. Next, we have to make the pairs of three bits on both sides of the binary point. If there will be
one or two bits left in a pair of three bits pair, we add the required number of zeros on extreme
sides and write the octal digits corresponding to each pair.

Example 1: (152A.25)16

Step 1:

We write the four-bit binary digit for 1, 5, 2, A, and 5.

12 | Page
S1BCA DIGITAL FUNDAMENTALS NUMBER SYSTEM

(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

 Hexadecimal to Binary

The 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 four-bit 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

Binary Arithmetic
Binary arithmetic includes the basic arithmetic operations of addition, subtraction, multiplication and
division

Binary Addition:

The binary number system uses only two digits 0 and 1 due to which their addition is simple. The
rules to perform binary addition are

0+0=0

0+1=1

1+0=1

1 + 1 = 0 with a carry 1

The above first three equations are very identical to the binary digit number. The column by column
addition of binary is applied below in details.

Eg: Let us consider the addition of 11101 and


11011.

13 | Page
S1BCA DIGITAL FUNDAMENTALS NUMBER SYSTEM

The above sum is carried out by following step

1 + 1 = 10 = 0 with a carry of 1.

1+0+1 = 10 = 0 with a carry of 1

1+1+0 = 10 = 10 = 0 with a carry of 1

1+1+1= 10+1 = 11= 1 with a carry of 1

1 +1 +1 = 11

Thus the required result is 111000.

EXAMPLE 2. Add the binary numbers 1101.101 and 111.011.

Binary Subtraction:

The rules to perform binary subtraction are

0–0=0
1–0=1
1–1=0
10 – 1 = 1

The above first three operations are easy to understand as they are identical to decimal subtraction.
The fourth operation can be understood with the logic two minus one is one.

14 | Page
S1BCA DIGITAL FUNDAMENTALS NUMBER SYSTEM

For a binary number with two or more digits, the subtraction is carried out column by column as in
decimal subtraction. Also, sometimes one has to borrow from the next higher column.

Consider the following subtraction 1100-1010

The above subtraction is carried out through the following steps.

0–0=0

For 0 – 1 = 1, taking borrow 1 and then 10 – 1 = 1

For 1 – 0 , since 1 has already been given, it becomes 0 – 0 = 0

1–1=0

Therefore the result is 0010.

EXAMPLE 2 Subtract 111.1112 from 1010.012.

In the 2–3 column, a 1 cannot be subtracted from a 0. So, borrow a 1 from the 2–2 column
making the 2–2 column 0. The 1 borrowed from the 2–2 column becomes 10 in the 2–3 column
becomes 10 in the 2–3 column. Therefore, in the 2–3 column, 10 – 1 = 1.

In the 2–2 column, a 1 cannot be subtracted from a 0. So, borrow a 1 from the 2–1 column, but
it is also a 0. So, borrow a 1 from the 1’s column. That is also a 0, so borrow a 1 from the 2’s column
making the 2’s column 0. This 1 borrowed from the 2’s column becomes 10 in the 1’s column. Keep
one 1 in the 1’s column, bring the other 1 to the 2–1 column, which becomes 10 in this column. Keep
one 1 in the 2–1 column and bring the other 1 to the 2–2 column, which becomes 10 in this column.
Therefore,

In the 2–2’s column 10 – 1 = 1

15 | Page
S1BCA DIGITAL FUNDAMENTALS NUMBER SYSTEM

In the 2–1’s column 1–1=0


In the 1’s column 1 – 1 =0

Now, in the 2’s column, a 1 cannot be subtracted from a 0; so, borrow a 1 from the 4’s column.
But the 4’s column has a 0. So, borrow a 1 from the 8’s column, making the 8’s column 0, and bring it
to the 4’s column. It becomes 10 in the 4’s column. Keep one 1 in the 4’s column and bring the second
1 to the 2’s column making it 10 in the 2’s column. Therefore,
In the 2’s column 10 – 1 = 1
In the 4’s column 1–1=0
In the 8’s column 0–0=0

Hence, the result is 0010.0112.

Representation of Binary Numbers and Binary Arithmetic in Computer

Binary Number Representation

Our computer can understand only (0, 1) language. The binary numbers are represented in both ways,
i.e., signed and unsigned. The positive numbers are represented in both ways- signed and unsigned,
but the negative numbers can only be described in a signed way. The difference between unsigned
and signed numbers is that unsigned numbers do not use any sign bit for positive and negative
numbers identification, but the signed number used.

 Unsigned Numbers

As we already know, the unsigned numbers don't have any sign for representing negative
numbers. So the unsigned numbers are always positive. By default, the decimal number
representation is positive. We always assume a positive sign in front of each decimal digit.

There is no sign bit in unsigned binary numbers so it can only represent its magnitude. In zero and
one, zero is an unsigned binary number. There is only one zero (0) in this representation, which is
always positive. Because of one unique binary equivalent form of a number in unsigned number
representation, it is known as unambiguous representation technique.

Example: Represent the decimal number 102 in unsigned binary numbers.

Binary number of (102)10 is (1100110)2, a 7-bit magnitude of the decimal number 102.

16 | Page
S1BCA DIGITAL FUNDAMENTALS NUMBER SYSTEM

 Signed Numbers

So far, we have considered only positive numbers. The representation of negative numbers is also
equally important. There are two ways of representing signed numbers—sign-magnitude form
and complement form. There are two complement forms: 1’s complement form and 2’s
complement form

Most digital computers do subtraction by the 2’s complement method, but some do it by the 1’s
complement method. The advantage of performing subtraction by the complement method is
reduction in the hardware. Instead of subtracting one number from the other, the complement of
the subtrahend is added to the minuend.

Sign-Magnitude

In sign-magnitude form, an additional bit called the sign bit is placed in front of the number.
If the sign bit is a 0, the number is positive. If it is a 1, the number is negative .Apart from this sign-bit,
the n-1 bits represent the magnitude of the number.

For example:

1’s Complement

17 | Page
S1BCA DIGITAL FUNDAMENTALS NUMBER SYSTEM

By inverting each bit of a number, we can obtain the 1's complement of a number. The
negative numbers can be represented in the form of 1's complement. In this form, the binary
number also has an extra bit for sign representation as a sign-magnitude form.

The 1’s complement system for representing signed numbers works like this:

1. If the number is positive, the magnitude is represented in its true binary form and a sign bit 0 is
placed in front of the MSB.

2. If the number is negative, the magnitude is represented in its 1’s complement form and a sign bit 1
is placed in front of the MSB.

That is, to represent the numbers in sign 1’s complement form, determine the 1’s complement of the
magnitude of the number and then attach the sign bit. The 1’s complement operation on a signed
number will change a positive number to a negative number and vice versa. The conversion of
complement to true binary is the same as the process used to convert true binary to complement. The
representation of + 51 and – 51 in both 1’s complement forms is shown below:

For Example:

2
’s Complement

By inverting each bit of a number and adding plus 1 to its least significant bit, we can obtain the 2's
complement of a number. The negative numbers can also be represented in the form of 2's
complement. In this form, the binary number also has an extra bit for sign representation as a sign-
magnitude form.

The 2’s complement system for representing signed numbers works like this:

1. If the number is positive, the magnitude is represented in its true binary form and a sign bit 0 is
placed in front of the MSB.

2. If the number is negative, the magnitude is represented in its 1’s complement form and a sign bit 1
is placed in front of the MSB.

That is, to represent the numbers in sign 2’s complement form, determine the 2’s complement of the
magnitude of the number and then attach the sign bit. The 2’s complement operation on a signed
number will change a positive number to a negative number and vice versa. The conversion of
complement to true binary is the same as the process used to convert true binary to complement. The
representation of + 51 and – 51 in both 2’s complement forms is shown below:

For Example:

18 | Page
S1BCA DIGITAL FUNDAMENTALS NUMBER SYSTEM

The below example shows +51 and -51 in all signed representation

1’s Complement Arithmetic

In 1’s complement subtraction, add the 1’s complement of the subtrahend to the minuend. If
there is a carry out, bring the carry around and add it to the LSB. This is called the end around carry.
Look at the sign bit (MSB). If this is a 0, the result is positive and is in true binary. If the MSB is a 1
(whether there is a carry or no carry at all), the result is negative and is in its 1’s complement form.
Take its 1’s complement to get the magnitude in binary.

Example 1: Subtract 14 from 25 using the 8-bit 1’s complement arithmetic.

Example 2: Add – 25 to + 14 using the 8-bit 1’s complement method.

Example 3: Add – 25 to – 14 using the 8-bit 1’s complement method

19 | Page
S1BCA DIGITAL FUNDAMENTALS NUMBER SYSTEM

Example 4: Add + 25 to + 14 using the 8-bit 1’s complement arithmetic

Example 5: Add + 25 to – 25 using the 8-bit 1’s complement method.

2’s Complement Arithmetic

The 2’s complement system is used to represent negative numbers using modulus arithmetic.
The word length of a computer is fixed. That means, if a 4-bit number is added to another 4-bit
number, the result will be only of 4 bits. Carry, if any, from the fourth bit will overflow. This is called
the modulus arithmetic.
For example: 1100 + 1111 = 1011. In the 2’s complement subtraction, add the 2’s complement
of the subtrahend to the minuend. If there is a carry out, ignore it. Look at the sign bit, i.e. MSB of the
sum term. If the MSB is a 0, the result is positive and is in true binary form. If the MSB is a 1 (whether
there is a carry or no carry at all) the result is negative and is in its 2’s complement form. Take its 2’s
complement to find its magnitude in binary.

Example 1: Subtract 14 from 46 using the 8-bit 2’s complement arithmetic.

20 | Page
S1BCA DIGITAL FUNDAMENTALS NUMBER SYSTEM

Example 2: Add – 75 to + 26 using the 8-bit 2’s complement arithmetic.

Example 3: Add – 45.75 to + 87.5 using the 12-bit 2’s complement arithmetic.

Example 4: Add 27.125 to – 79.625 using the 12-bit 2’s complement arithmetic

There is no carry. The MSB is a 1 indicating that the result is negative and is in its 2’s
complement form. The 2’s complement of 11001011.1000 is 00110100.1000. Therefore, the result is
– 52.5.

BCD numbers- concept and addition.

Binary codes can be classified as numeric codes and alphanumeric codes. Numeric codes
are codes which represent numeric information, i.e. only numbers as a series of 0s and 1s. 8421, XS-3,
Gray code are numeric codes. Numeric codes used to represent the decimal digits are called
Binary Coded Decimal (BCD) codes. 8421, 2421, 5211 are BCD codes. Alphanumeric codes are
codes which represent alphanumeric information, i.e. letters of the alphabet and decimal numbers as a
sequence of 0s and 1s. EBCDIC code and ASCII code are alphanumeric codes.

21 | Page
S1BCA DIGITAL FUNDAMENTALS NUMBER SYSTEM

Binary Coded Decimal number system is system in which decimal numbers from 0 to 9 are
represented by four bit binary number. It is often called BCD number system. Each bit of BCD
number has a positional weight. The weights are assigned as per the position occupied by these digits.
The weight of the first position (right most) is 2 0(1), the second 21(2), the third 22 (4) and the fourth
23(8). Reading from left to right, the weights are 8-4-2-1, and hence binary coded decimal number
system is also called 8421 code.

The binary conversion of 7 is (111)2, but the same number is represented in Binary Coded Decimal
system in four bit form as (0111). Also, the numbers from 0 to 9 are represented in the same way as in
binary system but after 9 the representation in BCD are different. For example, the decimal number
12 in binary system is (1100)2 but the same number in BCD is represented as [0001 0010]. Note that
each digit (1 & 2 separately) has been replaced by its equivalent 4-bit binary form.

The representation of decimal numbers from 0 to 15 in binary and equivalent binary coded decimal
system is tabulated below:

Decimal Number Binary Number Binary Coded Decimal (BCD)


0 0000 0000
1 0001 0001
2 0010 0010
3 0011 0011
4 0100 0100
5 0101 0101
6 0110 0110
7 0111 0111
8 1000 1000
9 1001 1001
10 1010 0001 0000
11 1011 0001 0001
12 1100 0001 0010
13 1101 0001 0011
14 1110 0001 0100
15 1111 0001 0101

8421 BCD CODE (NATURAL BCD CODE)

In this code, each decimal digit, 0 through 9, is coded by a 4-bit binary number. It is also called
the natural binary code because of the 8, 4, 2 and 1 weights attached to it. It is a weighted code and is
also sequential. Therefore, it is useful for mathematical operations. The main advantage of this code
is its ease of conversion to and from decimal. It is less efficient than the pure binary, in the sense
that it requires more bits. For example, the decimal number 14 can be represented as 1110 in pure
binary but as 0001 0100 in 8421 code. Another disadvantage of the BCD code is that, arithmetic
operations are more complex than they are in pure binary. There are six illegal combinations
1010, 1011, 1100, 1101, 1110 and 1111 in this code, i.e. they are not part of the 8421 BCD code
system. A disadvantage of the 8421 code is that, the rules of binary addition and subtraction do not
apply to the entire 8421 number but only to the individual 4-bit groups.
22 | Page
S1BCA DIGITAL FUNDAMENTALS NUMBER SYSTEM

BCD Addition

BCD is a numerical
code. Many
applications
require arithmetic
operations.
Addition is the
most important of
theses because the
other operation,
namely subtraction,
multiplication
and division, can
be done using addition.

The rule for


addition of
two binary coded
decimal (BCD)
numbers is given below.
 Add the two numbers using the rules for binary addition.
 If a four-bit sum is equal to or less than 9, it is a valid BCD number.
 If a four-bit sum is greater than 9, or if a carry-out of the group is generated, it is invalid
result. Add 6 (0110)2 to the four-bit sum in order to skip the invalid states and return the code
to BCD. If a carry results when 6 is added, add the carry to the next four-bit group.

Example 1-: Add the BCD numbers 1001 and 0100.

23 | Page
S1BCA DIGITAL FUNDAMENTALS NUMBER SYSTEM

Example 2: Perform the following decimal additions in the 8421 code.

24 | Page

You might also like