Addition involving eight-bit 2's complement numbers and indicating overflow.

In summary, 8-bit 2's complement numbers are a way of representing signed integers in binary form. Addition with these numbers is performed using the same method as binary addition, but overflow can occur when the result is too large to be represented by 8 bits. Overflow is indicated by the carry bit and can result in an incorrect answer.
  • #1
shamieh
539
0
Perform the following operations involving eight bit 2's complement numbers and indicate whether arithmetic overflow occurs.

1.
00110110 + 01000101 = 01111011 Overflow: there is none because we are adding to positive numbers.

Did I do this correctly?
 
Technology news on Phys.org
  • #2
The sum is correct, and there is indeed no overflow, but not because you are adding two positive numbers. When you add 1 to 01111111, there is an overflow.
 

Related to Addition involving eight-bit 2's complement numbers and indicating overflow.

1. What are 8-bit 2's complement numbers?

8-bit 2's complement numbers are a way of representing signed integers in binary form. They use 8 bits (1 byte) to represent a number, with the leftmost bit being the sign bit. A 0 in the sign bit represents a positive number, while a 1 represents a negative number. This method of representation allows for both positive and negative numbers to be represented using the same number of bits.

2. How do you perform addition with 8-bit 2's complement numbers?

To add two 8-bit 2's complement numbers, you simply add the two numbers together using the same method as binary addition. If the result is greater than 8 bits, the extra bit is dropped and the result is considered to have overflowed. This overflow can result in an incorrect answer.

3. What is overflow in the context of addition with 8-bit 2's complement numbers?

Overflow occurs when the result of adding two 8-bit 2's complement numbers is too large to be represented by 8 bits. This can happen when adding two positive numbers, two negative numbers, or a positive and a negative number. Overflow is an indication that the result is incorrect and needs to be adjusted.

4. How do you indicate overflow when adding 8-bit 2's complement numbers?

Overflow is indicated when the result of adding two 8-bit 2's complement numbers is either greater than 127 or less than -128, as these are the maximum and minimum values that can be represented with 8 bits. To indicate overflow, the carry bit (the leftmost bit that was dropped) is used. If the carry bit is 1, it means that the result has overflowed and the answer is incorrect.

5. Can addition with 8-bit 2's complement numbers ever produce an incorrect answer?

Yes, addition with 8-bit 2's complement numbers can produce an incorrect answer if there is overflow. This can happen when adding two numbers with the same sign (both positive or both negative) that result in a number larger than 127 or smaller than -128. In these cases, the carry bit will be 1, indicating that the result has overflowed and is incorrect.

Similar threads

  • Programming and Computer Science
Replies
1
Views
3K
  • Programming and Computer Science
Replies
1
Views
4K
  • Programming and Computer Science
Replies
1
Views
3K
Replies
5
Views
2K
  • Programming and Computer Science
Replies
17
Views
1K
  • Programming and Computer Science
Replies
1
Views
1K
  • Programming and Computer Science
Replies
4
Views
12K
  • Programming and Computer Science
Replies
2
Views
8K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
5
Views
1K
Back
Top