In: Computer Science
Assume -122 and -66 are signed 8-bit decimal integers. Calculate -122 + (- 66). and -122 - (- 66). Do we have overflow or underflow after each operation? Why?
Overflow or underflow happens when the result of addition or subtraction is greater or less than than specified range.Overflows do not happen in multiplication and division
im.performing the additions in decimal and then in explaining why overflow or underflow occurs with reference to range of number for this representation
If we have 8 bit signed magnitude no
We have seven bits for number magnitude and 1 bit for sign
Maximum decimal value that can be represented in 7 bit binary is ==127 (when all 7 1's are there in magnitude)
So maximum value in 8 bit signed magnitude is =127 in decimal
If sign bit =1 and all 7 bits are ones then no is -127 this is minimum value in decimal
If we add -122-66=-192
-192 does not lie between -127 to 127 so underflow occurs in final operation when 2 numbers are added.
Second case
Final arithmetic expressions
-122+66 =56
which lies between -127 to 127 so no underflow occurs
If you are having any doubts please ask i will answer asap