2’s Complement of a Binary Number || How to find negative numbers 2's complement - IndianDeal

IndianDeal

Indian deal is providing latest offers and news beneficial for the students and to the job seekers.

Breaking

Post Top Ad

Sunday 10 September 2023

2’s Complement of a Binary Number || How to find negative numbers 2's complement

1’s Complement of a Binary Number

To get 1’s complement of a binary number, simply invert the given number. For example, 1’s complement of binary number 110010 is 001101.

2’s Complement of a Binary Number

There is a simple algorithm to convert a binary number into 2’s complement. To get 2’s complement of a binary number, simply invert the given number and add 1 to the least significant bit (LSB) of given result.  Implementation of 4-bit 2’s complementation number is given as following below.

Example-1 − Find 2’s complement of binary number 10101110.

Simply invert each bit of given binary number, which will be 01010001. Then add 1 to the LSB of this result, i.e., 01010001+1=01010010 which is the answer .

2’s Complement of negative numbers

Step 1: Write the absolute value of the given number in binary form. Prefix this number with 0 indicate that it is positive. 

Step 2: Take the complement of each bit by changing zeroes to ones and ones to zero. 

Step 3: Add 1 to your result. This is the two’s complement representation of the negative integer. 

EXAMPLE: Find the two’s complement of -17 

Step 1: 1710 = 0001 00012 

Step 2: Take the complement: 1110 1110 

Step 3: Add 1: 1110 1110 + 1 = 1110 1111. 

Thus the two’s complement for -17 is 1110 11112

Daily offers

Post Bottom Ad