The Gateway to Computer Science Excellence

First time here? Checkout the FAQ!

x

+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 ?

+4 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.4k
- Engineering Mathematics 5.9k
- Digital Logic 2.3k
- Programming & DS 4.3k
- Algorithms 3.7k
- Theory of Computation 4.6k
- Compiler Design 1.7k
- Databases 3.4k
- CO & Architecture 2.9k
- Computer Networks 3.4k
- Non GATE 1.2k
- Others 1.3k
- Admissions 506
- Exam Queries 482
- Tier 1 Placement Questions 22
- Job Queries 64
- Projects 15

40,903 questions

47,558 answers

146,289 comments

62,305 users