One's Complement is a method for representing negative numbers by inverting every bit in the positive binary representation ( becomes , and becomes ). However, this system is rarely used in modern hardware because it results in two different representations for zero ( and ).
Two's Complement solves the 'double zero' problem by inverting the bits and then adding to the LSB. This creates a single representation for zero and allows the CPU to perform subtraction using the same hardware logic as addition.
In an 8-bit Two's Complement system, the MSB represents a negative weight (). This allows for a range of values from to .
Binary to Hexadecimal: Group the binary string into sets of four bits (nibbles) starting from the right. Convert each 4-bit group into its corresponding Hexadecimal digit ().
Denary to Binary (Successive Subtraction): Find the largest power of 2 that is less than or equal to the denary number. Subtract it, place a '1' in that column, and repeat the process with the remainder.
Denary to Hexadecimal (Division): Divide the denary number by 16 and record the remainder as the rightmost digit. Continue dividing the quotient by 16 until it reaches zero, recording remainders from right to left.
| Feature | Binary | Hexadecimal | Binary Coded Decimal (BCD) |
|---|---|---|---|
| Base | 2 | 16 | 10 (represented in 4-bit binary) |
| Symbols | 0, 1 | 0-9, A-F | 0000 to 1001 |
| Efficiency | High for hardware | High for human readability | High for decimal display accuracy |
| Primary Use | Internal CPU logic | Memory addresses, Color codes | Calculators, Digital clocks |
Check the MSB: When working with signed numbers, always check if the question specifies 'unsigned' or 'Two's Complement'. If it is Two's Complement and the MSB is 1, the number is negative.
Verify Overflow: In 8-bit addition, if the result requires a 9th bit, an overflow error has occurred. In signed arithmetic, an overflow is indicated if adding two positive numbers results in a negative sign bit (or vice versa).
Nibble Alignment: When converting Hex to Binary, ensure every Hex digit is converted into exactly four binary bits, including leading zeros (e.g., Hex must be , not just ).
The 'Add 1' Error: A frequent mistake in Two's Complement is inverting the bits but forgetting to add the final to complete the conversion to a negative value.
BCD vs. Binary: Students often confuse BCD with pure binary. Remember that BCD is strictly for representing decimal digits ; binary patterns like (10) are invalid in standard BCD.
Range Limitations: Forgetting that an -bit signed number has a different range than an -bit unsigned number. An 8-bit unsigned number goes up to , but a signed one only goes to .