Binary representation | ||||||||||||
Unsigned binary | ||||||||||||
Non-negative values | ||||||||||||
Signed magnitude | ||||||||||||
Reserve one particular bit for the sign. | ||||||||||||
Sign bit: If msb is 0, then positive value, if msb is 1, then negative value. | ||||||||||||
One's complement | ||||||||||||
Negate (flip) each bit. | ||||||||||||
Two's complement | ||||||||||||
1. flip all bits | ||||||||||||
2. add 1 (ignoring any carry out of the msb) | ||||||||||||
Excess/bias | ||||||||||||
Add K to the number | ||||||||||||
Convert to unsigned binary | ||||||||||||
Binary coded decimal (BCD) | ||||||||||||
uses unsigned binary to represent each decimal digit. | ||||||||||||