in CO and Architecture retagged by
914 views
0 votes
0 votes
The overflow condition for unsigned 8 bit integer would be if c= a+b if c<a Or c< b

The overflow condition for signed 8 bit integer would be if c= a+b if c<a and  c< b

right ??
in CO and Architecture retagged by
914 views

2 Answers

1 vote
1 vote
For c = a + b, UNSIGNED

The overflow condition for unsigned 8 bit integer would be c < a or c < b

For c = a + b, SIGNED

We can't say anything like that. We need to say only with respect to the sign of the input numbers. If the sign of a and b are same but the sign of c is different, there's overflow. If a and b are of different sign, overflow cannot happen.

(When a = -3 and b = -5, c = -8 but there is no overflow and c < a and c < b)
by

1 comment

Oh yes in signed thing the overflow will happen when both the number are positive and results come out to be negative

And in second Case when both the operands are negative and results is positive ! Right?
0
0
0 votes
0 votes

The first statement is correct but for the second one the correct statement should be some what like this:

"There will be overflow if the result (c>a and c>b) or (c<a and c<b)"

so for the second case only one condition is specified but the other one is not specified. so second statement is wrong.

 

Please correct me if the explanation is wrong