SIGN AND MAGNITUDE

From WikiEducator
Jump to: navigation, search

Sign and Magnitude

When a value is represented using sign and magnitude, the left hand bit, the most significant bit, is used solely to determine the sign of the number.

most significant bit = 1 negative number
most significant bit = 0 positive number


For example:

1010 = -2
0010 = +2

This means that a 4-bit number cannot represent any value greater than 7 because the 4th bit is used to indicate the sign. However the 4 bits can still represent 15 different values when the negative numbers are included. These values are: -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4 , 5, 6, 7

If there was no sign bit, 4 bits would represent the following 16 values: 0, 1, 2, 3, 4, 5 , 6, 7, 8, 9, 10, 11, 12, 13, 14, 15


Question 1 - Can you work out why there are only 15 values when you use sign and magnitude but 16 when there is no sign bit?
Answer - If you write out all the values for both representations, you'll see that there are two different versions of zero in sign and magnitude (0 = 0000 and -0 = 1000). These mean exactly the same.



Reference

Sign and Magnitude