<<< 1's complement integers     Index     Computing 2's complement example >>>

8. 2's complement integers


  • Positive integers are represented in a straightfoward positional scheme.

  • Corresponding negative integer binary representations are calculated by the following steps:

    1. Invert each bit of the positive number.

    2. Add 1.

    3. If there is a carry over from the highest bit, ignore it.

  • The same steps are used to go from negative back to positive number.

  • 8 bit two's complement:

    Binary value Two's complement interpretation Unsigned interpretation
    00000000 0 0
    00000001 1 1
    ... ... ...
    01111110 126 126
    01111111 127 127
    10000000 -128 128
    10000001 -127 129
    10000010 -126 130
    ... ... ...
    11111110 -2 254
    11111111 -1 255

<<< 1's complement integers     Index     Computing 2's complement example >>>