Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialDerrick Kennerly
961 PointsI'm not understanding how to figure out the math or getting the correct answer. I need it broken down a little simpler.
The video was very fast. I understand that binary uses 2 as a base number. That is where I am stuck.
2 Answers
Brendan Whiting
Front End Web Development Techdegree Graduate 84,738 PointsYou go from right to left. So the number the farthest to the right is the number of times you have 2^0, then the next number to the left is the number of times you have 2^1, etc, and you add it all up. So in the question, "What number is represented by the byte 00000001?" the answer is "1", because 2^0 is 1, and that's all there is.
Steve Hunter
57,712 PointsHi Derrick,
Binary is a little obscure, I must agree!! We use base 10; computers use base 2. So, when we have a multiple digit number, the first (right-most) number is the least significant, 'cos they're the "ones", the "units". Next along are the tens, ten, twenty and thirty etc. Those, obviously, can be cobined such as twenty-two is written 22.
Binary is the same, but we work in two. The right-most digit again, is the units column, so 1 or zero units. Next along are the "twos", so one-zero, amounts to one two and no units; one-one is one ten and one unit. Each digit added to the left of the number grows in significance by two each time. Just as we have 10s, 100s, 1000s in base 10, we have 2s, 4s and 8s. etc.
Trying to map this out is tricky but I'll give it a go ...
64 ... 32 ... 16 ... 8 ... 4 ... 2 ... U
0 ... 1 ... 1 ... 0 ... 0 ... 0 ... 0
This represents the binary number 110000 (I skipped the first 0). In binary this number is just that, 110000 - it has no way of being verbalised; it is unrelated to one-hundred-and-ten-thousand. They have no connection.
To convert to decimal, we use the numbers aove; the column numbers that have the least significant bit at the right. So we have 1 x 32 + 1 x 16 = 48. So our decimal 48 is represented by 110000 in binary.
I hope that helped a little on a concept that can be difficult to grasp!
Steve.
Derrick Kennerly
961 PointsDerrick Kennerly
961 PointsThanks Brendan. It seemed like Mandarin at first but now I understand. I'm new to this so its gonna take some time to get used to everything.