Signed Integers
Signed binary integers can be either positive or negative. The most significant bit (MSB) indicates the number’s sign. A value of 0 indicates that the integer is positive, and 1 indicates that it is negative. For example,
Negative Integer: (-26)10 = |
1 |
1 |
1 |
0 |
0 |
1 |
1 |
0 |
Positive Integer: (38)10 = |
0 |
0 |
1 |
0 |
0 |
1 |
1 |
0 |
Two’s Complement Notation
Negative integers are represented by using
two’s complement representation, which is the integer’s additive inverse.
Adding an integer’s additive inverse to the integer itself gives a value zero. Its definition is
The two’s complement of a positive number N in base r with n digits is rn - N for N ≠ 0 and 0 for N = 0.
Two’s complement representation is useful to processor designers because a single digital circuit can handle both addition and subtraction.
The following two steps can also be used to find the two’s complement of a binary integer. The two’s complement operation is reversible.