Monday, February 15, 2016

Binary Subtraction

Subtracting Binary Numbers

  • Computers use addition process to implement subtraction.
  • Computers have adder circuitry but there is no separate circuitry for subtractors.
  • To implement A-B, the computer takes the 2’s complement of B and then adds it to A.
  • 2’s Complement: Invert all the bits of a binary number and then add 1 to the result.
  • Inverting (changing all 0s to 1s and 1s to 0s) all the bits of a binary number is called 1’s complement.
Take 2’s complement of 10011101.
10011101binary number
011000101’s complement
+1
=011000112’s complement

Subtract 10011101 from 10011111.
10011111 – 10011101
= 10011111 + 2’s complement of 10011101
= 10011111 + 01100011
= 00000010 (Discard the last carry)
= 10



Related topics:
Counting in Decimal, Binary, Hexadecimal   |   Binary Addition   |   Hex Addition   |   Hex Subtraction   |   Hexadecimal to Decimal Conversion

List of topics: Microcomputer

No comments:

Post a Comment