On Friday we learnt binary at school. I learnt conversion of decimals(as in numbers of base 10) to binary before on my own from a book, but never really understood the system until now. At school, they taught us to break the decimal into powers of 2 to convert. The method I learnt earlier was to subtract the largest possible power of 2 from the decimal. If that was possible, it was represented by 1. If not, it would be represented by 0.
Example:
15 - 8 = 7 ==> 1
7 - 4 = 3 ==> 1
3 - 2 = 1 ==> 1
1 - 1 = 0 ==> 1
Therefore 15 = 1111 in binary or base 2
17 - 16 = 1 ==> 1
1 is too large to subtract 8 ==> 0
1 is too large to subtract 4 ==> 0
1 is too large to subract 2 ==> 0
1 - 1 = 0 ==> 1
Therefore 17 = 10001 base 2.
Then, of course, I noticed 16, 8, 4, 2, 1 are all powers of 2(1 = 2 power of 0).
I must really be a bit of a Charlie Gordon to have not noticed this earlier.

No comments:
Post a Comment