Negative numbers are stored in the computer

Source: Internet
Author: User
  1. Negative numbers are stored in the computer in the form of complement, the highest bit 1 is negative, 0 is positive, and the complement method is convenient for addition operation.

  2. BYTE type numeric range 128 to 127.

    The highest bit is the flag bit, 1272 binary is 01111111, then 127 is 10000001,-128=-127-1, so the second binary is 10000000

  3. byte b=11111111; positive expression: 00000001, i.e. b=-1;

  4. Positive number is reversed plus 1 for its negative representation, then negative plus 1 will get its positive form?

    Example: -3=1111 1101; after inversion: 0000 0010; Plus 1:0000 0011 = 3;

    So the negative number of the inverse plus 1 will get its positive form;

    So what does a negative minus 1 get back?

    Minus 1:1111 1100; take the inverse: 0000 0011=3, then also get its positive form

Negative numbers are stored in the computer

Related Article

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.