Subtraction in binary may be carried out by using a process called Twos Complement. This relies on certain underlying properties of binary numbers that enable us to represent a positive number as a negative number. As ( a - b ) is the same as ( a + ( -b )) we can use this trick to perform subtractions with negative numbers and additions.
Negating a binary number uses the Flip and Add method. All the bits in the number are flipped; which is to say 0 becomes 1 and 1 becomes 0. (See the section on logical NOT for more information.) 1 is then added to this number to give the negative. For example:
|Add to 98||00110011||51|
NB All binary numbers must use the same number of digits. In this case numbers are padded with 0 where necessary
When working with negative numbers the range of numbers changes. For example an 8 bit number goes from 00000000 to 11111111 or 0 to 255. If negative numbers are used then the range changes. The 8 bits still have 256 possible values but the range changes to values between 127 and -128.
Next: Hexadecimal Subtraction