Two's Complement: 8-bit Arithmetic - 8710 - 2910

  • Thread starter naspek
  • Start date
In summary, two's complement is a method of representing signed numbers in binary form by flipping the bits and adding 1. In 8-bit arithmetic, it is used to represent both positive and negative numbers within a range of -128 to 127. Its purpose is to simplify arithmetic operations on both positive and negative numbers. However, it cannot be used for division and has limitations such as a limited range and reduced precision.
  • #1
naspek
181
0

Homework Statement


Perform the following arithmetic operation using 8-bit
two's complement

a) 8710 - 2910


The Attempt at a Solution


i just want to know.. am i converting the number correctly?

89 = 0101 1001
-29 = 1110 0011
 
Physics news on Phys.org
  • #2
Yep, you did that correctly.
 
  • #3
thanks.. =)
 
  • #4
naspek said:

Homework Statement


Perform the following arithmetic operation using 8-bit
two's complement

a) 8710 - 2910
One quibble: you wrote 87 above, but worked with 89 below.
naspek said:

The Attempt at a Solution


i just want to know.. am i converting the number correctly?

89 = 0101 1001
-29 = 1110 0011
 
  • #5


To perform this operation using 8-bit two's complement, we first need to convert the numbers to their binary representation. The first number, 87 in decimal, is equal to 0101 0111 in binary. The second number, 29 in decimal, is equal to 0001 1101 in binary. To convert a positive number to its two's complement, we first take the binary representation and flip all the bits (0s become 1s and 1s become 0s). Then, we add 1 to the result. Therefore, the two's complement of 29 is 1110 0011. Now, we can perform the subtraction by adding the first number to the two's complement of the second number.

0101 0111 + 1110 0011 = 0011 1010

Since the result is in binary, we need to convert it back to decimal to get the final answer. In this case, the result is equal to 58 in decimal. Therefore, the answer to 8710 - 2910 using 8-bit two's complement arithmetic is 58.
 

1. What is two's complement?

Two's complement is a method of representing signed numbers in binary form. It involves flipping the bits of a number and adding 1 to the result to get the negative equivalent of the original number. This allows for efficient arithmetic operations on both positive and negative numbers.

2. How is two's complement used in 8-bit arithmetic?

In 8-bit arithmetic, two's complement is used to represent both positive and negative numbers within a range of -128 to 127. This is achieved by reserving the first bit (also known as the sign bit) as the indicator of the number's sign. A value of 0 in the sign bit represents a positive number, while a value of 1 represents a negative number.

3. What is the purpose of using two's complement in arithmetic operations?

The use of two's complement in arithmetic operations allows for the addition, subtraction, and multiplication of both positive and negative numbers without the need for separate algorithms for each operation. This simplifies the process and reduces the amount of code needed to perform these operations.

4. Can two's complement be used for division in 8-bit arithmetic?

No, two's complement cannot be used for division in 8-bit arithmetic. This is because two's complement is not a reversible operation, meaning that it cannot be used to accurately represent fractions or decimals. For division, a different method called "signed magnitude" is used.

5. Are there any limitations to using two's complement in 8-bit arithmetic?

Yes, there are some limitations to using two's complement in 8-bit arithmetic. One limitation is that the range of numbers that can be represented is limited to -128 to 127. Additionally, because the first bit is reserved as the sign bit, there are fewer bits available for representing the magnitude of the number, which can result in less precision compared to other methods of representing numbers.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
2
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
5
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
8
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
10K
  • Engineering and Comp Sci Homework Help
Replies
7
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
988
  • Engineering and Comp Sci Homework Help
Replies
10
Views
1K
Back
Top