|
|
Back to dictionaryTwo's complement representation is a standard among computers today. It provides an easy way to perform arithmetic on binary numbers. Its rules are simple:
0 + 0 = 0
0 + 1 = 1
1 + 1 = 0, carry over a 1 to next significant binary digit
0101 is the 4-bit representation of 5 in decimal. To get the representation of -5, we must first invert the bits. 0101 becomes 1010. We're not finished though. We must add 1 to 1010 to get the true value. -5 in decimal is 1011 in binary.
Find more about two's complement in these tutorials: Subtraction
|
|