Why is it that an arithmetic overflow cannot occur when adding an positive and a negative number using two’s complement. If you could please provide an example with 8-bit signed integers (bytes).
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This … kind of sounds like homework. Did you mean to use the ‘homework’ tag?
The reason you can’t overflow is because adding a positive
xand a negative numberywill produce a valuezsuch thatabs(z) < abs(x)andabs(z) < abs(y). Sincexandycould be represented without overflow, andzis closer to zero than either one,zcan also be represented without overflow.Any pair of positive and negative numbers form an example.