Binary MADNESS Part II

My professor for this course was pretty hardcore. Being an old school Bulgarian mathematician he was all about making us understand how computers work with numbers, and doing it with a paper and pencil. Since there is surprisingly little about doing this that can be found on the internets, and it is kind of neat, here is how to do it.

Manually converting to binary:

13/2 = 6 remainder = 1
6/2 = 3 remainder = 0
3/2 = 1 remainder = 1
1/2 = 0 remainder = 1

The result of the conversion is reading the remainders from bottom to top: 1101 = 13

Manually converting fractional numbers to binary:

This is a little different. You multiply by two and if it makes 1 you remove the one and continue without it. The results of the conversion are all the ones and zeros that you have been putting off to the side this time read from top to bottom. It does get a little weird as you will see, because converting things like 0.5 or 0.625 hit 0 and ends very quickly:

0.5 X 2 = 1.0 | 1
0.0 X 2 = 0.0 | 0

0.5 is 0.10 in binary

0.625 X 2 = 1.25 | 1
0.25 X 2 = 0.5 | 0
0.5 X 2 = 1.0 | 1
0.0 X 2 = 0.0 | 0

0.625 = 0.101 in binary

Converting something like 0.8 will never hit 0 and must be stopped at some arbitrary point so the computer does not get stuck in an infinite loop:

0.8 X 2 = 1.6 | 1
0.6 X 2 = 1.2 | 1
0.2 X 2 = 0.4 | 0
0.4 X 2 = 0.8 | 0
0.8 X 2 = 1.6 | 1
0.6 X 2 = 1.2 | 1
0.2 X 2 = 0.4 | 0
0.4 X 2 = 0.8 | 0
0.8 X 2 = 1.6 | 1
0.6 X 2 = 1.2 | 1
0.2 X 2 = 0.4 | 0
0.4 X 2 = 0.8 | 0

That kind truncating of values gives mathematicians Tourette’s, because it effectively means that computers are incapable of generating a (mathematically) correct answer to any question. But if you know what you are doing you can generate an answer that is correct enough for whatever you are doing.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s