Why can complement realize symbol bit operation? For example, I want to know an easy to understand explanation, especially the complement of negative numbers Your answer is also the conclusion that I have come to during this period of study. Indeed, it is better to understand the meaning of the complement given to the number by directly corresponding the complement with the number

Why can complement realize symbol bit operation? For example, I want to know an easy to understand explanation, especially the complement of negative numbers Your answer is also the conclusion that I have come to during this period of study. Indeed, it is better to understand the meaning of the complement given to the number by directly corresponding the complement with the number


In my opinion, this problem is caused by unnecessary actions. The original intention of the design of complement code is to show that all data members participate in the operation, and cooperate with certain overflow rules under a given word length to get the correct result. You should not think that there is a complement code, for example, the decimal 26 code of one byte is 00011010, while the - 26 code is 11100110, Don't think that 11100110 is 00011010. It's easy to understand. We can understand that the codes of positive and negative numbers are different. Otherwise, why do positive numbers have the same complement and only negative numbers need to be supplemented? I don't understand why theorists have to go around like this at the beginning and confused many people



The complement representation range of 8-bit signed numbers


The range is - 128 to 127. According to several rules of complement, we can deduce the above conclusion: 1. If every bit of binary is 0, it means number 02. If the highest bit (i.e. sign bit) is 0, it means positive number. 3. If the highest bit is 1, it means negative number. What is the absolute value of the negative number



In signed numbers, is 10 million a positive number or a negative number? What is its complement?


This number is negative, and is - 128. For example, for 8-bit signed number, 7-bit represents data bit, and the 8th bit is sign bit, the range of signed decimal number it can represent is - 128-127



How to complement a signed hexadecimal number and how to perform decimal conversion?
In decimal conversion, do you want to negate the following 15 to 1111 1111 1111 1111, and then add 1 to make it 10000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000?


The problem is very simple. Don't think about it
The landlord mistakenly changed it into a 10 base system into a complement code
It's totally different to change to decimal and complement, because complement is still binary, which is another binary representation
Next, I will think that the landlord asked the binary complement to solve this problem
Before solving this problem, the owner needs to understand that there are two expressions when 0 is represented by the original code
+0 and - 0 + 0 are 0000, sign bit is 0-0 is 1000, sign bit is 1
I would like to add that the range that a complement can represent is - 2 ^ n ~ 2 ^ n-1 after the sign bit is removed
If your original code is not in this range, it cannot be expressed
The original code provided by the owner is 1 million, which is negative 0 (- 0)
In the complement, there is no concept of negative 0. Both the 0 and negative 0 of the complement are 0
So the landlord must change to + 0, that is, 0, 000, 000, 000, 000, 000
Therefore, your question itself is very strange, because no one uses negative 0 (- 0) to complement
If you insist, just follow what I said above. Because complement only supports positive 0
Complement is a 2-ary number representation, not 10-ary.10-ary and complement is not the same, do not confuse the landlord
Second question:
As I said before, only when 10 million is binary, can we use division sign to negate + 1 to find binary complement
When converting to hexadecimal, every 4 bits from left to right are combined into a hexadecimal bit, because the 4th power of 2 = 16
So it's (1000) 2 = (8) 16 (0000) 2 = (0) 16, and the end result is that (8000) 16 is still from left to right
Add another point to the landlord:
Why does a 4-bit binary represent a 1-bit hexadecimal
The standard of conversion is that the value they represent remains unchanged after conversion
For example, in the hexadecimal system, 10 is actually 16, because 1 ^ 16 = 1 ^ 10 + 6
The 16 numbers of 2 ^ 4 = 16: 0-15 are represented by 4-digit binary system, which can not be repeated or omitted. A 16 digit number on the left corresponds to a 4-digit binary number on the right
The landlord may ask me why the high position can be like this, because x 16 ^ n is equal to x 2 ^ 4 ^ n
As for how to find the decimal system for 10 million,
1 × 2 ^ 12 = 1 × 10 ^... + 1 × 10 ^... This is OK



How to calculate complement
I'm a vegetable
Be more detailed····


The complement operation should be different: 1 for positive number, its original code = complement; 2 for negative number, write its original code, and then negate by bit (except sign bit, the sign bit is the highest bit), and then add 1. For example, for 32-bit word - 8, its original code is 1000 0000 000, 1000 negate 1111 111



Complement calculation
If the 16 bit complement of an integer is ffffh, what's the decimal system of the number? How do I feel that - 1 and 65535 meet the requirements, but the answer is - 1 for detailed explanation (how to combine the highest bit of - 128 complement operator)


First of all, ask you to calculate the complement, the best way is not to convert the hexadecimal number to 10, but to convert it to 2. Back to this topic, the correct idea should be ffff (H) = 1111111 (b), that is, to convert it to 2



Is there no negative overflow in complement operation?
For example -0.01111-0.00101 =?


-0.01111-0.00101=?
This question does not overflow!
Because:
-01111 complement: 1.10001
-0.00101 complement: 1.11011
Add:
1.10001+1.11011=1.01100
1.01100 original code: - 0.10100
Overflow occurs only when the sign of the subtraction is opposite to that of the subtracted, but the result is the same as that of the subtracted



Read the complement operation, not very clear, who can help me list - 54 - 30 complement operation?


-The 54-30 system will be regarded as - 54 + (- 30). Take 8 bits as an example
[- 54] complement = 11001010
[- 30] complement = 11100010
+)-----------------
10101100 (carry discard)
[- 84] complement = 10101100
So, - 54-30 = - 84



On the operation of complement
When calculating, we always add the complements. If the complements of one or two positive numbers are added: 01xx + 01xx, then the leftmost bit is carried by the right bit (0 becomes 1). It's 1. It's a negative number


12XX



The 8-digit complement can represent the range of fixed-point decimals


-1~+(1-2^(-7))
That is: - 1 ~ + 0.1111