0% found this document useful (0 votes)
13 views6 pages

CSE 20CS11T U1 S4 Sy

The document discusses binary arithmetic, focusing on binary addition and subtraction, and introduces two methods for handling signed numbers: the Sign-Magnitude method and the Complementary method. It explains the advantages and disadvantages of both methods, particularly emphasizing the 1's and 2's complement systems for representing negative numbers. The 2's complement is highlighted as the most popular choice due to its ease of use in arithmetic operations and single representation of zero.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views6 pages

CSE 20CS11T U1 S4 Sy

The document discusses binary arithmetic, focusing on binary addition and subtraction, and introduces two methods for handling signed numbers: the Sign-Magnitude method and the Complementary method. It explains the advantages and disadvantages of both methods, particularly emphasizing the 1's and 2's complement systems for representing negative numbers. The 2's complement is highlighted as the most popular choice due to its ease of use in arithmetic operations and single representation of zero.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

FUNDAMENTALS OF COMPUTERS - 20CS11T 2020-21

BASICS OF LOGIC DESIGN


SESSION 04

COMPLEMENTS OF NUMBER SYSTEMS AND ARITHMETIC


OPERATIONS

BINARY ARITHMETIC
Binary arithmetic is essential part of all the digital computers and many other digital
systems.

Binary Addition
There are four rules of binary addition.

Example:

Binary Subtraction
There are four rules of binary subtraction.

Example:

COMPUTER SCIENCE AND ENGINEERING 1


FUNDAMENTALS OF COMPUTERS - 20CS11T 2020-21

In the above example so much of borrowing is required. This is the additional problem
for computer with signed or negative numbers.
Arithmetic operations in computer can be handled in two ways
1. Sign-Magnitude method
2. Complementary method

1. SIGN MAGNITUDE METHOD


In this method the most significant bit (MSB), the leftmost bit holds the sign (positive or
negative).
• If the MSB is a 0, this indicates that the number is positive.
• If the MSB is a 1, this indicates that the number is negative.

COMPUTER SCIENCE AND ENGINEERING 2


FUNDAMENTALS OF COMPUTERS - 20CS11T 2020-21

Example1
Decimal Sign-Magnitude
+6 0110
-6 1110
-0 1000
+0 0000

In a 4-bits computer world only 3 bits to hold the number


Example 2
Add the numbers (-4) and (+2) using a computer.
1100  (-4) First number
+ 0010 (+2) Second Number
========================
1110  (-2) Sum
Here, the computer has given the wrong answer of -6 = 1110, instead of giving the
correct answer of -2 = 1010.

Disadvantages
• There are two notations for 0(0000 and 1000), which is very inconvenient when
the computer wants to test for a 0 result.
• Complicates the design of the logic circuits that handle signed-numbers
arithmetic, because each of the sign and magnitude parts has to be processed
separately.
• Separate hardware circuits are required to do the addition and subtraction
operations.

For the above reasons, we should go for complementary method.

COMPUTER SCIENCE AND ENGINEERING 3


FUNDAMENTALS OF COMPUTERS - 20CS11T 2020-21

2. COMPLEMENTARY METHOD
Complements are alternative way of representing negative binary number. This
alternative method also as the unique property that subtraction, multiplication and
division can be performed using addition hardware.

Types of Complement Systems


• 1’s complement (One’s complement)
• 2’s complement (Two’s complement)

1’s complement (One’s Complement)


It is defined as the value obtained by inverting all the bits i.e. by changing one’s to zero’s
(1s to 0s) and zero’s to one’s (0s to 1s).
In general for n bits the range is -2n-1-1 to +2n-1-1.

Example:

COMPUTER SCIENCE AND ENGINEERING 4


FUNDAMENTALS OF COMPUTERS - 20CS11T 2020-21

Advantages
• It is quite convenient for the computer to perform arithmetic.
• Easy way to represent negative numbers.
• Changing sign reduces to complementing all the bits.

Disadvantages
• Not very simple to understand because it is very much different from the
conventional way of representing signed numbers.
• There are two notations for 0 (0000 and 1111).
• Arithmetic operations are not easier because of addition of end-around-carry-bit.
• Positive and Negative numbers need to be processes separately.

2’s complement (Two’s Complement)


It is defined as the value obtained by adding 1 (one) to the LSB (Least significant bit) to
the 1’s(one’s) complement of a binary number. i.e.
2’s complement = 1’s complement + 1
In general for n bits the range is -2n-1 to +2n-1-1.

COMPUTER SCIENCE AND ENGINEERING 5


FUNDAMENTALS OF COMPUTERS - 20CS11T 2020-21

Example:

Advantages
• Most popular choice for representing signed numbers.
• The algorithm for adding and subtracting is quite easy.
• The best representation for 0 (all 0 bits).
• It is easy extended to larger numbers of bits.
• End around carry bit addition does not occur in arithmetic operations. It is
ignored.
• Convenient for binary arithmetic.
Disadvantages
• It is not very simple to understand because it is very much different from the
conventional way of representing signed numbers.
• Overflow occurs if the result is out of range.
• Slightly more complex to obtain 2’s complement.

Comparisons between 1’s and 2’s complement


1’s Complement 2’s Complement

It has two zeros (+0 & -0) It has only single zero
It is obtained by taking 1’s complement
It can be easily obtained by using inverter
and adding one to it
Value range is less than 2’s complement Value range is unequal Value range is unequal
(-2n-1-1 to +2n-1-1) (-2n-1 to +2n-1-1)
It requires two separate operations Only one arithmetic operation required to
(Addition & subtraction) perform both.
It is often used in logical manipulations for
It is used only in arithmetic applications
inversion operations

COMPUTER SCIENCE AND ENGINEERING 6

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy