What is the original code
The original code (true form) is a computer representation of the fixed point binary numbers. Original code representation in front of a sign bit value increases (i.e., the highest bit is the sign bit): This bit is a positive number of 0, the bit is a negative number (0 has two representations: +0 and -0), the remaining bits It indicates the size of value.
Original code can not directly participate in the operation, it may be wrong. Mathematically e.g., 1 + (- 1) = 0, while in binary 00000001 + 10000001 = 10000010, converted to decimal -2. Obviously wrong.
How to convert a decimal to binary numbers -3
First obtain the absolute value of +3 -3
Decimal how it is converted into a binary methods such as:
More than 1 3/2 1
More than 1 1/2 0
And the remainder is obtained from 11 up to 32 to give full 0000 0000 0000 0000 0,000,000,000,000,011
+3 binary type int (32) is 0000 0000 0000 0000 The following start 0,000,000,000,000,011 topic
-3 from the first step is the original code as a binary number of +3
A second step to obtain the inverted 1,111,111,111,111,111 1,111,111,111,111,100 (0 to 1 1 to 0)
The third step is to obtain the inverted complement +1 obtained 1,111,111,111,111,111 1,111,111,111,111,101
-3 binary number is slightly above the
What 32-bit binary 11111111111111111111111111111001 decimal value?
11111111111111111111111111111001
As above, a length of 32 binary, i.e. the integer is negative, the first inverted, inverted to give:
00000000000000000000000000000110
+1 inverted to give:
00000000000000000000000000000111
Converted to decimal: 7
Since the difference is negative, minus-sign, converted -7