Honors ICS - 2 Coding
Honors ICS - 2 Coding
Coding Basic
Binary Conversions (decimal fraction) :

Subtraction
Subtraction (for 2 digits) , for decimal system:
: which is called 1’s complement of 100101 (1补码)
: is called 2’s complement of 100101 (2补码) (Add 1 from 1’s complement code)
So the subtraction become :

Signed Binary Numbers
Way 1 : let the first bit be the sign bit, then the remaining digit be the magnitude bits, but failed for the addition.
Way 2 : Use the 2’s complement code, and the addition is also the 2’s complement code of the answer.
Conclusion:
- Positive or 0 : binary code
- Negative : 2’s complement of
So for a 8-bit number : 00000000 - 11111111 :
-
If the first bit is 0, is the positive number or zero
-
If the first bit is 1, then is the 2’s complement code
Eg : 10000000 is -128, 10000001 is -127, 11111111 is -1
And when 2 numbers are added together with two different signed, it will never be overflow!
Update on 2026.9.15:
In fact, don’t need to distinguish positive and negative numbers distinctly. Just regard the first bit as !
Floating Numbersss
Use a scientific notation

The first number don’t need to be consider, as all the binary number will start with 1.
In precision :
- 32-bits : float / single precision
- 64-bits : double - precision
- 16-bits : half - precision
To Code Number
Hexadecimal :
Octal Numbers : same as hexadecimal number
BCD : just use 4 bits to show decimal numbers. (the column weights are: 80 40 20 10 8 4 2 1)
Gray Code : Each code between the neighbor, only 1 bit different (This is an unweighted code)
Construct method : by division and flip(Like mirror)

ASCII Code : alphanumeric code
CRC
