Arithmetic Overflow: 8-Bit 2's Compl & Estimation of Overflows

  • Thread starter Thread starter needhelp83
  • Start date Start date
  • Tags Tags
    Arithmetic
Click For Summary

Discussion Overview

The discussion revolves around the concept of arithmetic overflow in 8-bit two's complement representation, focusing on specific arithmetic operations involving both positive and negative integers. Participants analyze various operations to determine if overflow occurs and seek clarification on the estimation of overflows.

Discussion Character

  • Technical explanation, Conceptual clarification, Homework-related

Main Points Raised

  • One participant presents a series of arithmetic operations and their results, questioning whether overflow occurs in each case.
  • Another participant provides a range for two's complement representation, noting that in 8 bits, numbers can range from -128 to 127, highlighting the asymmetry in magnitude between the most negative and the largest positive number.
  • There is a request for guidance on understanding the overflow concept and whether the operations were performed correctly.
  • One participant asks for confirmation on whether their presentation of the operations aligns with the provided instructions.

Areas of Agreement / Disagreement

Participants express uncertainty regarding the correctness of the overflow estimations and whether the operations were performed according to the instructions. No consensus is reached on the correctness of the calculations or the understanding of overflow.

Contextual Notes

Some operations may depend on the interpretation of overflow conditions, and there are unresolved aspects regarding the calculations and their adherence to the instructions.

Who May Find This Useful

Individuals interested in computer science, particularly those studying binary arithmetic, two's complement representation, and overflow concepts in digital systems.

needhelp83
Messages
193
Reaction score
0
Perform the following operations, representing the decimal numbers in 8-bit two’s complement code. Analyze whether the operations produce arithmetic overflow. Explain how you have estimated the overflows.

20 – 5; 127 –126; 127 – 128; -20 – 111; -20 – (+111);
- 43 - 120; -127 – 2; - 126 – 2.

I am having a very difficult time trying to understand this overflow concept. Any guidance would be greatly appreciated


*20-5
0001 0100 (20)
1111 0100 (-5) 2's

1 0000 1011

No overflow

*127-126
0111 1111 (127)
1000 0010 (-126) 2's

1 0000 0001 No overflow

*127 - 128
0111 1111 (127)
1000 0000 (-128) 2's

1111 1111 No overflow or carryout

*-20-111
1110 1100 (-20) 2's
1001 0001 (-111) 2's

1 0111 1101 Overflow (adding two negatives gives a positive)

*-20 - (+111)
1110 1100 (-20) 2's
1001 0001 (-111) 2's

1 0111 1101 Overflow (adding two negatives gives a positive)

*-43-120
1101 0101 (-43) 2's
1000 1000 (-120) 2's

1 0101 1101 Overflow (Adding 2 negatives gives a positive)

*-127-2
1000 0001 (-127) 2's
1111 1110 (-2) 2's

1 0111 1111 (Overflow 2 negatives gives a positive)

*-126-2
1000 0010 (-126) 2's
1111 1110 (-2) 2's

1 1000 0000 (No overflow)


Am I doing this correctly?
 
Physics news on Phys.org
Any help?
 
In twos complement you can represent a range -2^(n-1) to +2^(n-1) - 1
So in 8 bits you can fit numbers from -128 to 127
An interesting feature is that the most negative number is larger magnitude than the largest positive number.
 
Have I shown this properly according to the instructions provided?
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
13K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
11K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 19 ·
Replies
19
Views
36K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 1 ·
Replies
1
Views
7K
  • · Replies 4 ·
Replies
4
Views
3K