The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
+1 vote
997 views
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 ?
asked in Digital Logic by (123 points) | 997 views

2 Answers

+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

answered by Veteran (367k points)
selected by
0
@arjun sir, in unsigned numbers does we call overflow as carry instead of overflow?
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
0
Yes, it overflows the registers but we call it "carry" :)
0
okay......but sir why we don't consider the overflow in unsigned numbers as it actually happens.
0
We consider it but we just call it carry. For signed numbers this happens for one bit position before than that of unsigned and its called overflow. Since, both signed and unsigned numbers uses the same status register, they are named so- this is my guess.
0
olrite sir....thnku
0 votes
IF YOU GET A CARRY IN UNSIGNED ARITHMETIC THEN IT IS A MUST OVERFLOW CONDITION

BUT FOR A SIGNED IT MAY OR MAY BE NOT . IN A SIGNED YOU GET OVERFLOW CONDITION ONLY WHEN ADDITION OF 2 NEGATIVE NUMBER GIVE POSTIVE AND ADDITION OF 2 POSITIVE NUMBER GIVE NEGATIVE RESULT :)
answered by Active (2.6k points)

Related questions

+2 votes
0 answers
1
+3 votes
2 answers
2
asked Nov 14, 2015 in Digital Logic by Anil Khatri Active (2.6k points) | 2.3k views


Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

44,147 questions
49,639 answers
163,293 comments
65,807 users