Why is the eight-bit binary number in the range of-128 ~~ + 127?

Source: Internet
Author: User

 

There are three methods for a computer to express the number of symbols: original code, reverse code, and complement code.
8-digit Original codeAnd Reverse codeThe range that can represent the number is -127 ~ 127
8-digit ComplementThe range that can represent the number is -128 ~ 127
So since the range is-128 ~ 127, it must be indicated by a supplementary code.
000-11111111 indicates-128 to-1, and indicates 0-127.
The 1111 1111 of the complement code is converted to the original code 1000 0001, that is,-1.
Complement is a method of binary representing negative numbers. the complement of a negative number is to add one to the anticode, while the positive number remains unchanged. The original positive number is the same as the reverse code. (-0) is replaced by (-128) in the complement code, so the range of the complement code is:

(-128 ~ 0 ~ 127) a total of 256.

Note: (-128) there is no corresponding source code and reverse Code, (-128) = (10000000)

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.