It 18 Palm Job _java Foundation second day _ binary conversion principle and complement storage method

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.