Monday, October 15, 2012

Introduction

First post!

So far CSC 104 has been very informative. I have learned a ton about the history of computers, the binary number system and a bit of coding in DrRacket. I also have thought of an easier way to convert from decimal to binary.

Here's how.

Example A.

234 to Binary.

Looking at the powers of 2, the number 234 is sitting in between 256 and 128. We want to use this to subtract the power of 2 less than our number from the number we wish to convert.

Subtraction                             Binary ( 1 if if subtract-able without becoming negative, 0 if negative)
234 - 128 = 106                        1
106 - 64 = 42                            1        (Now our number is 106, the next lowest power of 2 is 64)
42-32 = 10                                1
10-16 = NEGATIVE                    0
10-8 = 2                                    1
2-4 = NEGATIVE                        0
2-2 = 0                                      1
0-1 = NEGATIVE                        0

We continue this till we have subtracted 2^0 (this helps determine even/odd numbers).

234 in binary is therefore 11101010.

That's it for this week!


No comments:

Post a Comment