[Craig] In this video, we're going to look at how you add together two 8-bit binary integers.
(uplifting piano jingle)
So before we work through some examples with you, let's just go over the basic rules for binary addition.
So they're quite simple.
A zero and a zero in binary equals zero.
A zero and a one equals one.
A one and a one can't equal two because we don't have a two in binary.
So a one and a one in binary equals zero.
And then we carry a one to our next column because 1-0 in binary is the denary number two.
And finally, one plus one plus one in denary is three,
but we can't have three, so it's one, carry a one.
1-1 in binary is three in denary.
That's a one in a two column plus a one in the one column.
Now, these are the only four rules you're going to need at a GCSE level
when adding together two 8-bit binary numbers.
So let's work through some examples.
So here we have a binary number line,
and we always suggest you write this out in the exam.
You start with a one on the far right
and then you double each column as you go to the left.
Two, four, eight, et cetera.
We've shown you the two denary numbers on the right we're going to add together,
so we're going to add together 85 and 170.
So I've sped things along here and written out those two binary numbers.
Now in the previous video, we showed you how to do that,
but here we're going to focus on adding them together.
So we're going to start on the right-hand side with a column that has a weighting of one.
And we just follow the four rules of binary addition we went over at the start of the video.
So a one plus a zero is a one.
A zero plus a one is a one.
A one plus a zero is a one.
A zero plus a one is a one.
A one plus a zero is a one.
A zero plus a one is a one.
A one plus a zero is a one.
And a zero plus a one is a one.
A nice, simple, tidy, easy example to start with.
We add up every column that has a one in it.
So that's all of them, 128 plus 64 plus 32 and so on.
And we get 255,
which of course is the original numbers, 85 and 170, added together.
Okay, so let's take a look at another example.
This time, 43 plus 74.
So here I am again,
and I've written out the two binary numbers.
So let's start on the right.
A one and a zero is a one.
A one and a one is a zero.
And then we carry a one to the next column.
It's important to show these carries in the exam.
Write them underneath.
So now we have a zero and a zero and the carry one.
Well zero, zero and one is one.
One and one is zero, carry the one.
Zero, zero and the carry one is one.
One and zero is one,
zero and one is one,
and zero and zero is zero.
Again, you add up the columns that have the ones in.
So that's a 64 plus a 32 plus a 16
plus a 4 and a 1, giving us 117.
Okay, let's take one more example,
59 plus 124.
So again, I've written out their binary equivalents here.
Now why don't you pause this video now and on a scrap of paper,
write down the binary addition and then unpause the video and see how you did?
So a one and zero is a one,
a one and zero is a one,
a zero and one is a one.
A one and one is zero, carry a one,
a one, one and the carry one is one, carry the one.
Again, a one, one and a carry one is a one, carry the one,
a zero, one and the carry one is zero, carry the one,
and finally, the carry one is one.
So our binary answer is 1-0-1-1-0-1-1-1,
which is 183.
Let's do one last example here.
So we've got the numbers 95 and 222 in denary.
There they are written out under their binary weighting lines.
Again, we start on the right-hand side.
We have one and zero is a one,
a one and one is a zero, carry a one,
a one, one and a carry one is one, carry a one.
Again we have a one, one and a carry one is a one, carry a one,
another one, one and a carry one is one, carry the one.
zero, zero plus a carry one is just one.
One and one is zero, carry a one.
And here we have a zero, one and a carry one is zero,
and we need to carry an extra one.
And what's happened here is we've got an overflow.
Our carry one has gone beyond the capacity of our current storage line,
and this is something which might crop up in the exam.
The denary numbers 95 plus 222 should equal 317.
But if we read back the number we've actually got,
we've got a 1 in the 32 column,
a 1 in the 16, an 8, a 4 and a 1,
and that does not equal 317.
You might have spotted the reason for that.
That's because the denary number 95 can be stored in an 8-bit binary weighting line.
And the denary number 222 can be stored in an 8-bit binary weighting line.
But the sum of those two numbers, 317,
is too big to be stored in an 8-bit binary weighting line.
The maximum number that could be stored is 255.
We get this overflow, and the resulting number is now meaningless.
You would need to add an extra column on the left
beyond the 128 with a weighting of 256 to store this number
but as we say in your GCSE exams,
you'll only be expected to add 8-bit binary numbers.
(uplifting piano jingle)