# 2s-complement for sign integer conversion to binary

### Conversion

positive value - no change E.g. 00001100

negative value, X - 2^n E.g. -00001100 Under 8-bit 1s-complement: 2^8 - 12 = 244 = 11110100

Invert the bits to get the complement

**HACK** Convert using 1s bit-flipping, add-1

### Properties

If MSB is 1, it is negative

If MSB is 0, it is either 0 (000) or positive

Full 0s and 1s are positive and negative 0s respectively: 0000 = +0 1111 = -0

### Operations

Binary addition

- Binary add 2 numbers
- Ignore carry out of MSB
- Check for bit overflows
^{ᛦ}.

Binary subtraction

- Take 2s-complement of B
- Binary addition: complement B + A