HOME > S > Subtracting Binary Numbers: Simply Explained

Subtracting binary numbers: Simply explained

Binary numbers are based on the dual number system and consist only of zeros and ones. If you want to subtract binary numbers, you must first form the ones complement and then the twos complement from the subtrahend. After that, there is only one step left to get the result of the subtraction.

How are binary numbers subtracted?

Binary numbers are numbers that are encoded by zeros and irons, allowing them to be processed directly by computer processors. In the dual number system, numbers are counted from zero to one. If all digits of a binary number are at one, counting is continued by placing another one in front of the number and zeroing all other digits behind it. To subtract numbers in binary, the computer processor takes a roundabout route. Computers normally represent decimal numbers in an 8-bit format, that is, from a binary number with eight digits. This allows 256 numbers to be encoded. The ones and twos complement assigns these 256 numbers to the values -127 to +127, which makes it possible to subtract numbers by adding a number with a negative number. You form the ones complement by inverting the binary number, i.e. making a zero out of every one and a one out of every zero. You form the two's complement by adding a one to the one's complement.

You can use this method

  1. Build a one's complement from the subtrahend, that is, the number you want to subtract, by inverting the number.
  2. Build the two's complement from the one's complement by adding the number one to it.
  3. Run the subtraction as an addition by adding the two's complement, which is a coded negative number.

By Charry Echave

Android: Change font size - how to adjust it :: Ubuntu: View kernel version - how to do it
USEFUL LINKS