December 21, 2016

2’s complement

2’s complement:

The 2’s complement of a binary number can be obtained by first complement each bit of the number to get 1’s complement. Add 1 to this number to get 2’s complement.
For example, consider the number 14 whose binary representation is 1110. 1’s complement is 0001. Now, adding 1 to this number gives 0010 which is 2’s complement representation of -14. 

No comments:

Post a Comment