Assume a computer is using signed magnitude base 2 representation to store 8-bit values. Further, assume you have a program which can display the contents of 1-byte memory locations. However, the program displays hex (as a shorthand) instead of binary. What decimal values are represented by the following:
(a) C3
(b) 6E
Repeat the above, but assume the numbers are stored as 8-bit 2’s complement base 2.
In Signed Magnitude Representation of a n bit number we have one bit reserved that depicts the sign and rest n-1 bits tell the magnitude of that number .
SO MSB bits determined the Sign of the Number .
If MSB=0 Then number is Positive , if MSB = 1 then number is negative
Now we have hexadecimals number . So to get equivalent first write them in 8 bits binary
We have
1. C3 = 1100 0011
Now As MSB is 1 so Number is negative
Magnitude = 1000011 = 67
Hence Decimal value of C3 = -67
2. 6E = 01101110
Now As MSB is 0 so Number is positive
Magnitude = 01101110 = 110
Hence Decimal value of 6E = +110
This is how you can find equivalent decimal value for the given hexadecimal represented in the Signed Magnitude Representation
Now we have 2's complement Notation :
In This notation Positive number are represented same as in normal binary so there is no change but when we represent a negative numebr then we take 2's complement of its positive value only .
Here also MSB represent the Sign
To get Magnitude in case of positive number just get the equivalent decimal of 8 bit binary
But in Negative Number decimal value is equal to 2's complement of the Given 8- Bit binary
Lets see for given Numbers
.1. C3 = 1100 0011
Now As MSB is 1 so Number is negative
Magnitude = 2's complement ( 11000011)= 00111101 = 61
Hence Decimal value of C3 = -61
2. 6E = 01101110
Now As MSB is 0 so Number is positive
Magnitude ( no need of 2's complement as number is +ve)= 1101110 = 110
Hence Decimal value of 6E = +110
This how 2's complement notation works and we get equivalent decimal
Thank you
If you like the answer upvote it , if any doubt drop a comment in comment box
Get Answers For Free
Most questions answered within 1 hours.