To use this website fully, you first need to accept the use of cookies. By agreeing to the use of cookies you consent to the use of functional cookies. For more information read this page.

Jamie Balfour'sPersonal blog

I'm maybe going to have to make a category dedicated to tributes to people on my blog as this is now the second tribute in the last month.

Lee

By Avda (Own work) [CC BY-SA 3.0], via Wikimedia Commons

Anyway, Christopher Lee passed away on the 7th June 2015 at the age of 93. Whilst I'm obviously upset about this, Christopher Lee being my favourite actor of all time (as many of you will know), I'm not as upset as would be with someone younger. Christopher Lee was a happy man, who lived a long life and starred in some of the most icon films of the last century. He made his mark and had a good long life.

He starred in some amazing films including, James Bond: The Man with the Golden Gun, Star Wars, The Lord of the Rings and The Hobbit, Dracula, Sleepy Hollow (albeit brief) and so much more.

A rather interesting fact about Christopher Lee's family is that his mother married James Bond writer Ian Fleming's uncle making them 'step-cousins'. This is a nice little link between Lee and James Bond in which he starred in.

Interestingly, one of my mother's friends accommodated him whilst he was golfing at Muirfield in Gullane, Scotland.

I have known this day would come sooner or later as Lee had not been in good health several times over the past few years and it lead me to expect it at some point.

I would like to pay my respects to Christopher Lee as being one of the world's best actors (and one of my favourite of all time, if not my favourite, and will likely remain that way indefinitely).

christopher
lee
chris
saruman
scaramanga

Two's Complement is one of those tricky little things that you can easily mess up, but what if there was an easier way of doing it than the traditional methods?

Well indeed there is.

Let's do it.

Example 1

For this example, we're going try and calculate -64. This should be easy.

The first step is to figure out how many bits we are going to need. For this we will need 8 bits. As a result our first place holder will be 128.

128 64 32 16 8 4 2 1

But wait a moment, the next thing we do, and we do this before putting down the placeholders, is we want to calculate a negative for the first place holder.

So what do we do? Well here's my way of doing it, and I don't know of anyone else who does it this way but:

0 - (128 - 64) = -64

Now write that as the first place holder instead. We always have a 1 for a negative number (the sign bit) so put a 1 underneath it.

-64 64 32 16 8 4 2 1
1

The next step is to keep adding until you get to 0.

-64 64 32 16 8 4 2 1
1 1 0 0 0 0 0 0

Easy peasy.

-64 + 64 = 0

Example 2

Now for -34

0 - (128 - 34)

-94 64 32 16 8 4 2 1
1 1 0 1 1 1 1 0

-94 + 64 + 16 + 8 + 4 + 2 = 0

Like I say, I don't know anyone else who uses this, though I do know of a technique similar to it. If you're teaching this to students or pupils, I don't recommend using this to teach, just to check that they got the correct answer.

Posted by jamiebalfour04 in Tech talk
twos
complement
school
binary
calculator
Powered by DASH 2.0 (beta)
Code previewClose