When doing addition/subtraction on binary numbers in other representations we need to apply different logics (circuits) to perform addition and subtraction. In 2s-complement representation, we represent a positive number as it is and negative number by its corresponding 2s-complement, so we can use the same circuit to perform addition and subtraction.
For example: to add 6+3 using 5 bit 2s-complement representation,
To subtract 6-3, rewrite as 6+ (-3):
11101 (2s-complement of 3)
- How the negative numbers are stored in memory?
- Subtraction of two numbers using 2's Complement
- Check if one of the numbers is one's complement of the other
- Check if bits in range L to R of two numbers are complement of each other or not
- What’s difference between 1's Complement and 2's Complement?
- Complement of a number with any base b
- Previous number same as 1's complement
- Find One's Complement of an Integer
- 10's Complement of a decimal number
- 1's and 2's complement of a Binary Number
- 9's complement of a decimal number
- 8085 program to find 1’s and 2’s complement of 16-bit number
- 8085 program to find 1's and 2's complement of 8-bit number
- Find relative complement of two sorted arrays
- Efficient method for 2's complement of a binary string
- Interface 8255 with 8085 microprocessor for 1’s and 2’s complement of a number
- Check if binary representation of a given number and its complement are anagram
- 8085 program to find 2's complement of the contents of Flag Register
- Partition negative and positive without comparison with 0
- Check if a number is positive, negative or zero using bit operators
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.