I have a question about the method of two's compliment: Which of these two methods are correct, and how can I disprove the incorrect one?
Starting example task: Convert the negative denary number -20 to two's compliment negative binary number (which is held in 8-bit binary).
Method 1:
- Find the positive binary value of the number,
- flip the bits of that binary value
- add one to the flipped number
Example: for -20.. 20 in binary is 00010100, those bits flipped are 11101011, then add 1 to the flipped bits to get 11101100. So, 11101100 is -20 in two's complement.
Method 2:
- minus one from the positive denary value
- Find the positive binary number of that denary number
- Flip the bits of that binary number
Example: for -20.. 20 is the positive denary number so 20-1 = 19. 19 in binary is 00010011. Flip the bits: 11101100. 11101100 is -20 in two's complement.