Introduction to PHP original code, inverse code, and complement code
PHP original code, inverse code, complement code introduction
Original code:
is the "original binary code", which is actually a character code that we can understand after converting from decimal to binary. The original codes are all numerically understandable. However, in the actual operation of the computer, the original code is often not used, so there are problems with the inverse code and the complement code.
Based on this, the rule: the first bit of a binary number is the sign bit, 0 represents a positive number, and 1 represents a negative number.
Example: (8 bits are used as examples):
7: 00000111
-7: 10000111
Reverse code:
The complement of a positive number is itself.
The one's complement of a negative number is to invert each bit of the non-sign part of the original code. .
Example:
7: 00000111
-7: 11111000
Complement code:
The complement of a positive number is itself
The one's complement of a negative number, the sign bit remains unchanged, after each other bit is inverted, the whole number is increased by 1
Example:
7: 00000111
-7: 11111000 1 = 11111001
http://www.bkjia.com/PHPjc/1071706.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1071706.htmlTechArticlePHP original code, inverse code, complement code introduction PHP original code, inverse code, complement code introduction original code: That's it The original binary code is actually what we can understand after converting from decimal to binary...
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn