Is my 2's complement addition correct?

  • Thread starter Thread starter TranscendArcu
  • Start date Start date
  • Tags Tags
    Addition
Click For Summary

Homework Help Overview

The discussion revolves around performing additions in 8-bit binary two's complement representation. Participants are examining the correctness of specific binary addition problems and the interpretation of results in decimal form.

Discussion Character

  • Exploratory, Assumption checking, Conceptual clarification

Approaches and Questions Raised

  • Participants are questioning the method of converting binary numbers to decimal and the application of two's complement rules. There is also a discussion about the correct procedure for binary addition in two's complement form.

Discussion Status

The discussion is ongoing, with participants providing different perspectives on the correctness of the original poster's calculations. Some have pointed out potential misunderstandings regarding two's complement representation and addition, while others are clarifying the process involved.

Contextual Notes

There are indications of confusion regarding the conversion of binary to decimal and the handling of signed overflow in the context of the assignment. The original poster's calculations are being scrutinized for accuracy based on the rules of two's complement arithmetic.

TranscendArcu
Messages
277
Reaction score
0
Do the following additions in 8-bit binary two's complement:

a) 01110110 + 10001001 = (64+32+16+4+2) + (-(64+32+16+4+2+1)) = 118 -119 = -1
b) 11010101 + 10101010 = -(64+16+4+1) + (-(64+16+4+1+1)) = -86 -87 = -171

Have I done these correctly?
 
Physics news on Phys.org
You do understand that converting to base 10 combining adding those is NOT "twos complement" don't you?

What is the "twos complement" of 10001001.
 
TranscendArcu said:
Do the following additions in 8-bit binary two's complement:

a) 01110110 + 10001001 = (64+32+16+4+2) + (-(64+32+16+4+2+1)) = 118 -119 = -1
b) 11010101 + 10101010 = -(64+16+4+1) + (-(64+16+4+1+1)) = -86 -87 = -171

Have I done these correctly?

For starters, you're not even converting the numbers to decimal correctly.
A = f(B) = b_02^0 +b_12^1 +b_22^2 + ... + b_{n-1}2^{n-1} -b_n2^n
where A is the base 10 representation, B is a binary 2's complement representation of a number with n+1 digits with b_0 being the least significant digit. Note that only the last digit has a minus sign.
 
For two's complement addition in binary, you just add the two numbers as if they were unsigned binary numbers (ignoring any carries past the most significant bit), to get the sum. I don't know if this assignment requires that you indicate if signed overflow has occurred.
 

Similar threads

Replies
4
Views
2K
  • · Replies 10 ·
Replies
10
Views
2K
Replies
6
Views
1K
Replies
6
Views
4K
  • · Replies 3 ·
Replies
3
Views
1K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 9 ·
Replies
9
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 11 ·
Replies
11
Views
3K
Replies
12
Views
4K