1. What is the representation of negative numbers and why is it so designed?
A: In a computer system, values are all represented and stored in complement. The reason is:
(1) using the complement, the symbolic and numerical fields can be processed uniformly
(2) at the same time, addition and subtraction can also be processed uniformly
(3) In addition, the complement and the original code to convert each other, the operation process is the same, no need for additional hardware circuit
(4) use of complement to ensure that 0 has a binary representation
2.-128 How is it stored in memory? The calculation process?
-128 in-memory representation: 0000,
The calculation process:-127 of the complement form is 1000 0001,-1 of the complement form is 11111111,-127 and 1 complement form Add, remove carry 1, 1000 0000, that is, 128 of the complement form.
3. If the byte represents no 11111111, what is its true data?
1111 1111 take the inverse plus a 1000 0001, that is, 1 of the original code form, so its real data is-1.
4. do positive and negative numbers support the complement approach?
Negative numbers in the computer are represented by the inverse code, the positive complement form and the original code is the same, the complement of the negative number of the form is its original code to take back plus one.
5. is the positive number minus one negation?
No, for example:-1 of the complement is 1111 1111, minus one to 1111 1110, take the inverse 1000 0001, which is the original code form-1.
This article is from the "Canonlemon" blog, make sure to keep this source http://canonlemon.blog.51cto.com/8560316/1747173
It 18 Palm Job _java Foundation second day _ binary conversion principle and complement storage method