The Gateway to Computer Science Excellence

+1 vote

If we take a n bit register to store result of addition/subtraction of two n bit unsigned binary numbers , then if the end-carry occurs , then the end-carry is the part of the result . Is it overflow or not ?

If we take a n bit register to store result of addition/subtraction two n bit signed binary numbers , then if the end-carry occurs ,then it is the sign-bit of the result . Is it overflow or not ?

If we take a n bit register to store result of addition/subtraction two n bit signed binary numbers , then if the end-carry occurs ,then it is the sign-bit of the result . Is it overflow or not ?

+5 votes

Best answer

"If we take a n bit register to store result of addition/subtraction of two n bit unsigned binary numbers , then if the end-carry occurs , then the end-carry is the part of the result . Is it overflow or not ?"

It is indeed overflow. But overflow means nothing for unsigned operations. It is meant only for signed operations. If the carry happens out of the most significant bit position, then result is wrong and this is denoted by CARRY flag for unsigned numbers.

"If we take a n bit register to store result of addition/subtraction two n bit signed binary numbers , then if the end-carry occurs ,then it is the sign-bit of the result . Is it overflow or not ?"

Yes. It is overflow. And we get wrong answer here (since sign changes). And this is exactly why overflow flag is used for signed operations.

Overflow is useful for signed operations while carry flag is useful for unsigned operations.

http://teaching.idallen.com/dat2343/10f/notes/040_overflow.txt

0

Not really. Because overflow and carry are flags in CPU. They cannot have multiple meaning based on whether input is signed or unsigned. Most CPUs don't distinguish between signed and unsigned numbers (since they are represented using 2's complement form) and carry out operation.

0

so then what we will say when two unsigned numbers of n - bits gives result in ( n + 1 ) bits. It must definitely overflow the register which is for n bits. So, it should be called as overflow

- All categories
- General Aptitude 1.9k
- Engineering Mathematics 7.6k
- Digital Logic 2.9k
- Programming and DS 4.9k
- Algorithms 4.4k
- Theory of Computation 6.2k
- Compiler Design 2.1k
- Databases 4.1k
- CO and Architecture 3.4k
- Computer Networks 4.2k
- Non GATE 1.4k
- Others 1.5k
- Admissions 595
- Exam Queries 573
- Tier 1 Placement Questions 23
- Job Queries 72
- Projects 18

50,833 questions

57,747 answers

199,474 comments

108,090 users