The code of the original code back code complement shift

Source: Internet
Author: User
1, positive number of the original code, complement, anti-code are its own; 2, negative (binary) of the original code, complement, anti-code formula: Anti-code = The original code (except the sign bit) every bit of the reverse complement = anti-code + 1 anti-code = complement-1 Shift code = complement Symbol bit counter Purpose: inverse code: To solve the problem of negative addition operation, the subtraction operation is converted to addition operation, thus simplifying the operation rules; complement: solve the negative addition operation plus or minus 0 problem, make up the anti-code deficiencies. Anti-code and complement are to solve the problem of negative numbers, and positive, so, whether it is a positive integer or positive decimal, the original code, anti-code, complement are all the same. The original code, anti-code, and complement are symbolic fixed-point number representation method, the shift code commonly used to compare the size, the floating-point code is generally used to move the code to express, the code can be used to simplify floating-point numbers multiplication method operation. Assuming that the bit width of the data is 8 bits, the original code is the highest level for the sign bit, the other 7 bits is the data bit, so the range is ( -127~-0,0~127) the expression range of the inverse code is also ( -127~-0,0~127) complement the provision of 0 means 128 this number, so the complement of the expression range is: ( -128~0~127) Note:-128 is a special number, (-128) does not correspond to the original code and anti-code, ( -128) = (10000000) found a more in-depth, explained very good blog:/http Www.cnblogs.com/zhangziqiu/archive/2011/03/30/ComputerCode.html

The code of the original code back code complement shift

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.