Negative Numbers in Binary Operations
Computers do not store positive (+) and negative (-) signs, so they must use binary digits (0,1). There are 4 different formats to try and represent negative numbers:
- Signed magnitude
- Ones’ complement
- Two’s complement (This is most widely used.)
- Excess
Signed Magnitude Representation
In the sign–magnitude representation, also called sign-and-magnitude or signed magnitude, a signed number is represented by the bit pattern corresponding to the sign of the number for the sign bit (often the most significant bit, set to 0 for a positive number and to 1 for a negative number), and the magnitude of the number (or absolute value) for the remaining bits. For example, in an eight-bit byte, only seven bits represent the magnitude, which can range from 0000000 (0) to 1111111 (127). Thus numbers ranging from to can be represented once the sign bit (the eighth bit) is added. For example, encoded in an eight-bit byte is 10101011 while is 00101011.

Ones’ Complement
In the ones’ complement representation, a negative number is represented by the bit pattern corresponding to the bitwise, opposite of the positive number.
As an example, the ones’ complement form of 00101011 becomes 11010100 ().
Adding two numbers in this systems requires to do a necessary end-around carry. ![[Pasted image 20240229144325.png| An example of an “end-around carry”.]]
Two’s Complement
In the two’s complement