Signed magnitude, signed 1’s complement, and signed 2’s complement are three methods of representing signed numbers in binary form.
Signed magnitude
Signed magnitude representation represents a signed number using the most significant bit as a sign bit (0 for positive numbers, 1 for negative numbers) and the remaining bits as the magnitude of the number. For example, in 8-bit signed magnitude representation, the number +7 is represented as 00000111 and the number -7 is represented as 10000111.
Signed 1’s complement
Signed 1’s complement representation represents a signed number by taking the 1’s complement of the magnitude of the number and then adding a sign bit. The sign bit is 0 for positive numbers and 1 for negative numbers. For example, in 8-bit signed 1’s complement representation, the number +7 is represented as 00000111 and the number -7 is represented as 11111000.
Signed 2’s complement
Signed 2’s complement representation represents a signed number by taking the 2’s complement of the magnitude of the number and then adding a sign bit. The sign bit is 0 for positive numbers and 1 for negative numbers. To compute the 2’s complement of a number, we invert all its bits and add 1 to the result. For example, in 8-bit signed 2’s complement representation, the number +7 is represented as 00000111 and the number -7 is represented as 11111001.
The range of numbers in all three representations for 8 bit register is as follows:
Signed magnitude: -127 to +127
Signed 1’s complement: -127 to +127
Signed 2’s complement: -128 to +127