I had to learn binary for a class at school one time, and it was really lame, but whatever, thanks lol.
We use base-10 numeral, decimal (i.e. 0-9). The machines that we are currently operating on use base-2 numeral, binary (i.e. 0-1). 8 binary digits (bits) form a byte. ASCII characters consist of 8 binary digits, and therefore are the equivalent of a byte.
How Houses Form
Base-10:
What happens after 9? You got it, 10.
What happens after 99? You got it, 100.
What happens after 999? You got it, 1000.
Base-2:
What happens after 1? 10.
What happens after 11? 100.
What happens after 111? 1000.
Learn to Count
Base-10:
1's House: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 (contains all numbers before 10)
10's House: 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, etc. (contains all numbers before 100)
Base-2:
1's House: 0 (0), 1 (1) (contains all numbers before 2)
2's House: 10 (2), 11 (3) (contains all numbers before 4)
4's House: 100 (4), 101 (5), 110 (6), 111 (7) (contains all numbers before 8)
8's House: 1000 (8), 1001 (9), 1010 (10), 1011 (11), 1100 (12), 1101 (13), 1110 (14), 1111 (15) (contains all numbers before 16)
Do you notice a pattern?
Base-2's houses continually double. All houses contain the numbers before the name of the next largest house.
List of Houses
Base-10:
1000's, 100's, 10's, 1's (to calculate decimal, multiply the digits by their houses, and add all of the digits together).
I.e. 4028 = (4 * 1000) + (0 * 100) + (2 * 10) + (8 * 1)
Base-2:
256's, 128's, 64's, 32's, 16's, 8's, 4's, 2's, 1's (to calculate decimal, multiply the digits by their houses, and add all of the digits together).
I.e. 101101001 = (1 * 256) + (0 * 128) + (1 * 64) + (1 * 32) + (0 * 16) + (1 * 8) + (0 * 4) + (0 * 2) + (1 * 1), in decimal this equals 361.
Formula to calculate base-2 houses: 2^0 = 1, 2^1 = 2, 2^2 = 4, 2^3 = 8 etc.
Quick ways to convert to decimal
- Count how many bits there are. List that number of houses. Add all 1's house names together, ignore the 0's.
- 101111111 = 511 (next largest house name negative one) - 128 (only 0) = 383
Converting decimal to binary
- Grab your decimal number that you wish to convert. For this example, I'll use 42.
- Work out the highest possible binary house that you can that is lower than 42 (or your decimal number). In this case 32.
- Deduct this number from your decimal number (i.e. 42 - 32 = 10).
- Repeat steps 2 and 3 with your new decimal number (i.e. 10). 8. 10 - 8 = 2.
- Repeat step 4 until your decimal number is 0. 2. 2 - 2 = 0.
- List all of the houses lower than (and including) the number than you worked out in step 2. 32, 16, 8, 4, 2, 1.
- Work out which houses you deducted from your decimal number. Place a 1 in each of these houses. 32, 8, 2. (1 = yes / on / do).
- Work out which houses you did not deduct from your decimal number. Place a 0 in each of these houses. 16, 4, 1. (0 = no / off / don't). You should now have your binary number. In this case: 101010.
This took a fairly long time to write, so I hope it is useful to at least someone! Good luck.
Last edited by Charles; 6 March, 2009 at 23:03 PM. Reason: Typo.
Your Link Here ($8/mo) | Heart Attack Treatment | Heart Attack Warning Signs
I had to learn binary for a class at school one time, and it was really lame, but whatever, thanks lol.
My Awesome Signature is awesome...
Your Link Here ($8/mo) | Heart Attack Treatment | Heart Attack Warning Signs
Nice post Charles. But that is a bit too much for my little brains to process...
Maybe I should give it more time, or update my brains.
Your Link Here ($8/mo) | Heart Attack Treatment | Heart Attack Warning Signs
Nice workout Charles!
Reminds me of the days when computers where completely new to me (and probably many others) waaaayyy back in the early 80's. What I did then was to make a list of 0-255 (DEC) and then convert it to binary code by looking at a small sprite that I made on the screen. This was on the Commodore VIC-20 and later on the good old '64. Quite hilarious when I think about it now
Later in college, we learned some decent methods to convert BIN-DEC-HEX etc. but most of that has been forgotten.
I had to learn binary last year for one of my freshmen IT classes here at the Univeristy. I found base 2 pretty easy, but when we did base 8 and base 16 it took a little longer to catch on and get the numbers perfect.
01100010 01101001 01101110 01100001 01110010 01111001
Your Link Here ($8/mo) | Heart Attack Treatment | Heart Attack Warning Signs
Bookmarks