How do computers store neg binary numbers?

In summary, the number 11000001 in an 8-bit computer using 2's complement convention will be stored as -63. This is achieved by converting the number to its complement (00111111) and then adding the negative value of the MSB (-1*128) to the remaining bits. This method allows for negative numbers to be represented in binary form.
  • #1
_buddha
6
0

Homework Statement


Which of the following numbers will be stored in an 8-bit computer as 11000001? This computer uses the 2's compliment convention.

a)-64 b)-63 c)63 d)64


Homework Equations


1's and 2's compliment


The Attempt at a Solution


The answer is -63 and after trial and error i get that answer, but I am just wondering what exactly happens to the actual number. This is what my understanding is, so since the first digit in the number is a 1, therefore its negative. And after converting it to its compliment i get 00111111, which equals to 63 in base 10. So therefore the answer is -63. Is this the correct way of handling this question?
 
Physics news on Phys.org
  • #3
You can also just add the bits together, except remembering that for 2's complement, the MSB is negative.

-1 * 128 + 1 * 64 + 0 * 32 + 0 * 16 + 0 * 8 + 0 * 4 + 0 * 2 + 1 * 1 = -128 + 64 + 1 = -63
 

1. What is a negative binary number?

A negative binary number is a number represented in the binary number system (base 2) that has a negative value. In this system, the most significant bit (MSB) represents the sign of the number, with 0 indicating a positive number and 1 indicating a negative number.

2. How do computers represent negative binary numbers?

Computers use a system called two's complement to represent negative binary numbers. In this system, the MSB is still used to represent the sign, but the remaining bits are used to represent the magnitude of the number. This allows for easy addition and subtraction of both positive and negative numbers.

3. How does two's complement work?

In two's complement, the MSB is essentially used as a "flag" for whether the number is positive or negative. To find the value of a negative binary number, you take the two's complement of the positive version of the number. This is done by flipping all the bits and adding 1 to the result.

4. Can computers store an infinite range of negative binary numbers?

No, computers have a finite amount of memory and therefore can only store a certain range of numbers. The range of negative binary numbers a computer can store depends on the number of bits used to represent the number. For example, a computer using 8 bits can store values from -128 to 127.

5. How do computers handle arithmetic operations with negative binary numbers?

Computers use the same logic for arithmetic operations (addition, subtraction, etc.) with negative binary numbers as they do with positive numbers. The two's complement representation allows for easy addition and subtraction, and other operations can be done by converting the numbers to their decimal equivalents.

Similar threads

  • 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
10
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
8
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
5
Views
1K
Replies
4
Views
906
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
2K
Back
Top