-128 of the original code, back code, complement

Source: Internet
Author: User

Reference URL: http://www.cnblogs.com/zhangziqiu/archive/2011/03/30/ComputerCode.html

1, if the original code, so that the symbol bit also participate in the calculation, obviously for subtraction, the result is not correct. This is why the computer does not use the original code to represent a number.

2, set eight digits from high to low, respectively A7 A6 ... a0

The integer that it represents is:-a7* (2^7) +a6* (2^6) +a5* (2^5) +...+a0* (2^0)

Therefore, the smallest integer it can represent is: 10000000=-2^7=-128

The largest integer is: 01111111 = (2^7) -1=127

The desired minimum value of byte type, that is,-27.

The maximum value of the byte type, that is, 27-1.

3, 8-bit binary number is expressed in the range: -128 127

0,1,2,3,,127,-128,-127,-126,,-1,

4, about-1282 in the system is said:

The negative number is expressed by the complement, the complement of the positive number is its itself, the complement of the negative number is the binary system of 1,128 by the bit and the number of 10000000, the reverse is 01111111, plus 1 is 10000000.

5. Definition:
Original code: 10000000    This is-0 of the original code
: 11111111    This is-0 of the inverse code
: 10000000    This is-128 of the complement

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.