Use of sign and magnitude and two’s complement to represent negative numbers in binary
1.4.1 Data Types
Data Types — Note 3 of 10
Candidates should know how to store negative numbers using Sign and Magnitude and two’s complement. Candidates should be able to convert denary numbers to sign and magnitude, and two’s complement – and vice-versa
Negative integers can be represented in binary using sign and magnitude or two's complement. Two's complement is used by computers because binary addition works correctly with it and there is only one representation of zero.
Exam tipCommon mistake
The most significant bit (MSB) is the sign (0 = positive, 1 = negative) and the remaining bits hold the size of the number.
10101101. Range in 8 bits: -127 to +127.00000000 and 10000000), and normal binary addition gives wrong answers.The MSB has a NEGATIVE place value. In 8 bits the place values are -128 64 32 16 8 4 2 1.
11010011 (-128 + 64 + 16 + 2 + 1). Range in 8 bits: -128 to +127.+45 0 0 1 0 1 1 0 1
Flip bits 1 1 0 1 0 0 1 0
Add 1 + 0 0 0 0 0 0 0 1
-45 1 1 0 1 0 0 1 1
Check: -128 + 64 + 16 + 2 + 1 = -45