Thursday, February 22, 2007

Lab 6

BINARY CONVERSIONS!!!!!!!!!!!!!

This might just be the greatest point in my life as a nerd. But it is sort of interesting.... alright here is a crash course in converting binary to decimal and the other way around.

1. convert
110010101 to decimal form.
first what i would do would be map out a table with 2 rows and a column for every number in the binary code. The top row would be the binary numbers, and the bottom row would be the factors of 2 corresponding to the number of ones in the code. Sort of like this....

1 1 0 0 1 0 1 0
2^7 2^6 2^5 2^4 2^3 2^2 2^1 2^0

Now, forget the columns that have zero in them completely. For every column that has a one, calculate the factor of two that corresponds to it. Then add all of the added up factors of two, so you get something like this.

1 1 0 0 1 0 1 0
128 64 0 0 8 0 2 0

The final step to converting the binary to decimal is adding up the bottom row.
128 + 64 + 0 + 0 + 8 + 0 + 2 + 0 =
202!!
simple right!
Now lets go in the opposite direction.


1000010001

To convert from decimal to binary, there are just a few simple steps.
First, divide the number by 2, and keep the remainder separate from the answer, so you do not get a decimal.
Next, repeat the first step again until you reach the number 1.
Last, when you have reached one, just place 1 in front of the binary number, and put all the remainders together and this will be your string of binary numbers.

to see this process view the below steps.

529/2= 264 remainder 1 ........ 1

264/2= 132 remainder 0 ........01
132/2= 66 remainder 0.......... 0
01
66/2= 33 remainder 0............0
001
33/2=16 remainder 1.............1
0001
16/2=8 remainder 0...............0
10001
8/2=4 remainder 0................0
010001
4/2= 2 remainder 0...............0
0010001
2/2= 1 remainder 0..............0
00010001
1/2= 0 remainder 1..............1
000010001
so the binary code is
1000010001

Positional Vs. Non-positional Number Systems
The difference between positional and non-positional number systems is simple. A positional number system is based on where exactly the numbers lie in the sequence of numbers. A positional system needs a base (n) which each number on the line relates to based on its position. Numbers on the left are equal to the value of the numbers to the right of them times n. Inversely, the numbers to the right are equal to the numbers to the left of them divided by n.

A non-positional number system is not based on the physical position of numbers. For example the Roman Numeral number system is based on a symbol that changes according to the amount of the number.

No comments: