F451 Performing Integer Binary Arithmetic: Addition and Subtraction

A PDF I made explaining Binary addition and subtract. Its a pain so I hope this helps.

HideShow resource information
  • Created by: Jonathan
  • Created on: 23-05-12 15:19
Preview of F451 Performing Integer Binary Arithmetic: Addition and Subtraction

First 163 words of the document:

Performing Integer Binary Arithmetic: Addition and Subtraction:
At some point in your exam you may be asked to add or subtract some binary numbers. If you
convert them into denary (normal, base 10) numbers perform the calculation and then convert back
you will get the correct answer but no method marks! Instead you should do it like this:
Addition:
0+0 = 0
1+0 = 1
0+1 = 1
1+1 = 0 carry 1 forward
1+1+1 = 1 carry 1 forward
91 + 18 = 109
91 = 01011011 and 18 = 00010010
0 1 0 1 1 0 1 1
+ 0 0 0 1 0 0 1 0
= 0+0= 1 1+0= 1 0+1= 1 1+1= 0 1+0= 1 1+0= 1 1+1= 0 1+0= 1
carry 1 carry 1
= 0 1 1 0 1 1 0 1
128 64 32 16 8 4 2 1 = 109
0 1 1 0 1 1 0 1
To perform subtraction just use Two's compliment to make it a negative number and then add them
together
91 ­ 18
91 = 01011011
-18 as two's complement is -128 + 110 = 11101110
Add them
0 1 0 1 1 0 1 1
+ 1 1 1 0 1 1 1 0
= 1 1+1= 0 1+1+1= 1+1= 0 1+1= 0 1+1+1= 1+1= 0 1+1= 0 0+1= 1
carry 1 1 carry carry 1 carry 1 1 carry carry 1 carry 1
1 1
= 1 0 1 0 0 1 0 0 1
th
But the answer can only be 8 bits so cross out the 9 bit, giving: 01001001
-128 64 32 16 8 4 2 1 = 1+8+61 = 73
0 1 0 0 1 0 0 1
91 ­ 18 = 63
#NOTE: Work from right to left to help avoid confusion.#

Comments

No comments have yet been made

Similar Computing resources:

See all Computing resources »See all resources »