hamburger

2’s Complement – Uses, Addition & Subtraction

By BYJU'S Exam Prep

Updated on: September 25th, 2023

In 2’s complement number system, binary numbers are encoded. The Binary Number System is one of the most widely used number representation schemes in digital systems. There are just two symbols or possible digit values in the Binary System: 0 (off) and 1(on). The positive and negative numbers are encoded in 2’s complement number system.

In general, binary numbers have different kinds of complements: 1’s complement and 2’s complement. Simply invert the original number to get the 1’s complement, and the 2’s complement is the 1’s complement of the given number + 1 to the least significant bit (LSB).

Download Formulas for GATE Computer Science Engineering – Programming & Data Structures

What is 2’s Complement?

A two’s-complement number system encodes positive and negative values in binary form. Except for the most important bit, whose weight is the inverse of the corresponding power of two, the weight of each bit is a power of two.

The signed binary integers are also represented by 2’s complement. To determine the binary number’s 2’s complement, first, find the binary number’s 1’s complement and then add 1 to the least significant bit of it.

Uses of 2’s Complement

The representation of 2’s complement is unambiguous, it is highly helpful in computer number representation. A positive number is simply expressed as a magnitude form. So there is nothing to be done to represent positive numbers. However, if we want to represent a negative integer, we must use either the 1’s complement or the 2’s complement approach.

The 2’s complement of binary numbers is used in a variety of ways, most especially in signed binary number encoding and different mathematical operations for Binary numbers, such as additions and subtractions.

Download Formulas for GATE Computer Science Engineering – Algorithms

Addition using 2’s Complement

When we add two binary integers using 2’s complement, we can get three different cases, which are as follows:

Case 1: Addition of a positive and a negative number when the positive number is greater in magnitude.

Find the 2’s complement of the given negative number. Add the specified positive number to the result. If we receive an end-around carry 1, the number will be positive, the carry bit will be eliminated, and the remaining bits will be the final result.

Case 2: Addition of a positive and a negative number when the negative number is greater in magnitude.

Find the 2’s complement of the given negative number. Add the specified positive number to the result. There is no end-around carry, and the remaining bits will be the final result. The resultant is a negative value.

Case 3: Addition of two negative numbers

Find the 2’s complement of both the negative numbers. Add these 2’s complement numbers. If we receive an end-around carry 1,  the carry bit will be added to LSB, and forgetting the final result, we will take the2’s complement of the result. The resultant is a negative value.

Download Formulas for GATE Computer Science Engineering – Digital Logic

Subtraction using 2’s Complement

The adding an end-around carry-bit occurs only in 1’s complement arithmetic operations in 2’s complement arithmetic operations. The procedure for subtracting two binary numbers using 2’s complement is given below:

(Note: The subtrahend is the number that will be subtracted from another number, i.e., minuend.)

  • Take the 2’s complement of the subtrahend.
  • Add with the minuend
  • If the result of the preceding addition contains carry bit 1, it is discarded, and the result is a positive integer.
  • If there is no carry bit 1, then take the result 2’s complement, which will be negative.
Important Topics for Gate Exam
Brittle Material Capacitors in Parallel
Capacitors in Series Carnot Cycle
Cement Test Clamping Circuit
Clipping Circuit CMOS Fabrication
CMOS Converter Column Base
Our Apps Playstore
POPULAR EXAMS
SSC and Bank
Other Exams
GradeStack Learning Pvt. Ltd.Windsor IT Park, Tower - A, 2nd Floor, Sector 125, Noida, Uttar Pradesh 201303 help@byjusexamprep.com
Home Practice Test Series Premium