Adding binary numbers (overflow)

In summary, overflow occurs when the answer to adding or subtracting binary numbers exceeds the number of digits that can be contained, typically in a register on a computer. In this case, the leftmost digit is dropped, resulting in an incorrect answer. Examples of overflow include 1110+1010=11000 and 0101+0110=1011. It is important to note that overflow should be avoided as it can lead to incorrect results.
  • #1
leonne
191
0

Homework Statement


Hey, i don't really understand what they mean when its overflow when u add or subtract binary numbers like
1101
+
1010



Homework Equations





The Attempt at a Solution


I thought the answer is 10111 but they get +7 I know the+ is cause of the 1 in front but don't know why the answer is 7 and not 10111

I was thinking that the answer has more digits than the original but it seems not true from other examples
thanks
 
Physics news on Phys.org
  • #2
The assumption here is that you only have four digits to contain the answer, like in a register on a computer. It can't hold 10111. Something has to go. The adder you are talking about will apparently just drop the leftmost fifth digit 1. That's called overflow. So the register will contain the incorrect answer 0111=7. Overflow isn't a good thing.
 
  • #3
hey um i kind of thought of that, but why is 1110+1010 =11000 not overflow? or is it? In the book example for adding it shows this but says nothing about overflow and why is 0101+0110=1011 a overflow? Is it because there is a 0 in the beginning so you would only count 3 digits?
thanks
 

Related to Adding binary numbers (overflow)

What is the concept of adding binary numbers with overflow?

Adding binary numbers with overflow refers to the process of adding two binary numbers together and encountering a situation where the resulting sum is too large to be represented in the given number of bits. This leads to an overflow, where the extra bit is lost and the sum is represented with one less bit.

How does overflow occur in binary addition?

Overflow occurs in binary addition when the sum of two binary numbers exceeds the maximum value that can be represented by the given number of bits. For example, in a 4-bit system, adding 0111 and 0001 would result in 1000, which is 8 in decimal. However, since 4 bits can only represent numbers up to 7, an overflow occurs and the result is represented as 0000.

How can overflow be detected in binary addition?

Overflow can be detected in binary addition by checking the carry-out value of the most significant bit. If the carry-out is different from the carry-in, an overflow has occurred. In other words, if the sum of two positive numbers results in a negative number, or if the sum of two negative numbers results in a positive number, overflow has occurred.

What happens to the extra bit in an overflow situation?

In an overflow situation, the extra bit is lost and the resulting sum is represented with one less bit. This means that the original number of bits is no longer sufficient to represent the sum, and the value is truncated to fit the given number of bits.

How is overflow handled in computer systems?

In computer systems, overflow is typically handled by setting a flag to indicate that an overflow has occurred. This flag can then be checked by the computer program to determine how to handle the situation, such as by displaying an error message or performing special calculations to handle the overflow.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
4
Views
1K
  • Calculus and Beyond Homework Help
Replies
32
Views
2K
  • Calculus and Beyond Homework Help
Replies
3
Views
2K
Replies
4
Views
1K
  • Calculus and Beyond Homework Help
Replies
3
Views
1K
Replies
1
Views
720
  • Programming and Computer Science
Replies
4
Views
2K
  • Programming and Computer Science
Replies
3
Views
982
  • Engineering and Comp Sci Homework Help
Replies
2
Views
2K
  • Calculus and Beyond Homework Help
Replies
1
Views
5K
Back
Top