- #1
Fatima Hasan
- 319
- 14
- Homework Statement
- Why does the carry flag not work for signed number addition and the overflow does not work for unsigned numbers?
- Relevant Equations
- -
Here's my explanation with an example:
(d: decimal )
7d + 2d = 9 d
If signed:
the result indicates an overflow, because it exceeds the maximum which is +7.
( 0111 + 0010 = 1001 )
However, CF = 0 indicating that there is no overflow which is wrong.
OF = 0 ⊕ 1 = 1 -> invalid result, because the result exceeds the maximum.
If unsigned:
the result is valid because min= -8< 9 < max= 7
CF = 0
OF = 0 ⊕ 1 = 1 -> indicates that the result is invalid which is incorrect.
Is there any further explanations ?
(d: decimal )
7d + 2d = 9 d
If signed:
the result indicates an overflow, because it exceeds the maximum which is +7.
( 0111 + 0010 = 1001 )
However, CF = 0 indicating that there is no overflow which is wrong.
OF = 0 ⊕ 1 = 1 -> invalid result, because the result exceeds the maximum.
If unsigned:
the result is valid because min= -8< 9 < max= 7
CF = 0
OF = 0 ⊕ 1 = 1 -> indicates that the result is invalid which is incorrect.
Is there any further explanations ?
Last edited: