Two's complement
To get the two’s complement negative notation of an integer:
- write the number in binary
- invert the digits
- add one to the result
If the leftmost bit of a two’s complement number is 1
, the number is negative.
If the leftmost bit is 0, the number is 0
or **positive **
Convert from two’s complement number:
- Invert bits
- Add one to the result
Arithmetic with two’s complement
- Addiction
- Convert numbers to binary
- Add them
- Subtraction
- Convert numbers to binary
- The number after minus is converted to two’s complement number
- Add them