Data Representation using Signed Magnitude (1)
Binary Number Representation
There are four ways to represent binary numbers:
Unsigned Magnitude
Signed Magnitude
1's Complement
2's Complement
Unsigned Magnitude
Can only represent positive binary numbers.
For example:
+6 is represented as 110.
Cannot represent -6 in this format since it only handles positives.
Signed Magnitude
Can represent both positive and negative numbers.
Positive number representation:
Example: +6 is represented by its magnitude.
Magnitude of 6 = 110
Add an extra bit (sign bit): 0 for positive.
Therefore, +6 in signed magnitude is 0110.
Negative number representation:
Example: -6 uses the same magnitude but a different sign bit:
+6 = 110 (magnitude)
Add a sign bit of 1 (indicating negative).
Thus, -6 in signed magnitude is 1110.
Sign Bit Importance
The sign bit determines positivity or negativity:
0 = Positive
1 = Negative
It splits the representation into two parts:
Sign bit dictates the sign.
Remaining bits represent the magnitude.
Additional Examples
To represent +13:
Magnitude = 1101
Sign bit = 0 (for positive).
Therefore, +13 is 01101.
For -13:
Magnitude = 1101
Sign bit = 1 (for negative).
Therefore, -13 is 11101.
Range of Signed Magnitude
The range for signed magnitude is:
From -2^(n-1) + 1 to 2^(n-1) - 1
Where n is the number of bits used.
For n=4:
Range: From -7 to +7.
Calculation:
Min: - (2^3 - 1) = -7
Max: 2^3 - 1 = 7
Homework Problems
1st Problem: Represent +5 and -5.
2nd Problem: Represent +9 and -9.
3rd Problem: Represent +16 and -16.
Use signed magnitude representation for all problems.