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 trialJoseph Mathew
264 PointsHello, Can someone please help explain binaries and decimals in a more simplistic manner? Thank you, Joe
I need to understand Binaries and Decimals and their differences. Is there an easy way to learn and understand it?
4 Answers
Jennifer Nordell
Treehouse TeacherNote: I'm going to use the ^ here to denote to the power of, because I can't get the superscript to work in the markdown. So 2^3 = 8. Two to the power of 3 is 8.
Well, I don't know if you're a Big Bang Theory fan or not, but let's take a look at the binary representation of Sheldon's favorite number 73. 1001001 You've probably never even thought about this before because you're so used to counting in base 10, but 73 is the same as saying : 10^0 x 3 = 3 10^1 x 7 = 70 When we add these together we get 73 of course. But let's look at how we translate binary to decimal. We only need to look at the places that hold a 1 because obviously the sum will not be affected by zeros as zero times anything is zero. So 2^0 = 1 plus 2 ^3 = 8 plus 2^6 = 64. Add those all up and you get a total of 73.
edited because of markdown problems with superscript
A X
12,842 PointsHi Joseph, In terms of binary, I'd suggest checking out the message board posts on binary: https://teamtreehouse.com/community/topic:digital-literacy/q:binary
But in short summary, binary is a completely different way of looking at counting. We live our lives in something called "Base 10" (probably because we have 10 fingers and toes to count with). So things start with 1 and go to 10 (so we have 10 base values to work with). So, for reasons I don't understand, computers were programmed in base 2 counting (probably because it took up less memory is my guess on those old computers the size of buildings). So the computer only knows how to count from 0 to 1. So the computer we know and love today translates everything it does from binary (aka base 2) to what we want the computer to do. In short, binary is simply another way of counting. :-) The computer has to do more complicated math (exponents) to translate its way of counting into ours, no different from translating like Italian into Japanese.
I'm not sure what all you'd like to know about decimals, but they're something used in math to measure smaller amounts than whole numbers...in computer programs there's typically 2 number types: decimal and floating point. Both of them use a decimal place, but the decimal type only goes out to the hundredth's place (2 decimal places, and no more than that) and typically decimal type is used with money, so $99.99 would be a decimal. Floating point can have any number of decimals, like the mathematical function pi: 3.14159265 is an example of a floating point. I think they call it floating point because the amount of decimals can "float around" (or it can vary) just like a feather doesn't float to the ground in a straight line.
Jennifer Nordell
Treehouse TeacherAbby Mann "So, for reasons I don't understand, computers were programmed in base 2 counting (probably because it took up less memory is my guess on those old computers the size of buildings)." I'd like to elaborate on that if I may. Actually no, your guess isn't correct. At the physical hardware level of a circuit board everything comes down to whether something has a charge or not. Either it has a charge or it doesn't. A charge indicates typically a 1 and no charge indicates a 0. So when you're writing to a hard drive all you're really doing is changing the charge on that particular bit. You know when you write to a CD/DVD you can sort of see afterwards a different coloring that indicates that its been written to. This is because we use a laser to make tiny valleys in the CD/DVD. Up is either 1 or zero and down is the other. So yes, everything comes down to 1 or 0. True or false. And this is just how circuit boards work.
Stephen Shine
5,991 PointsI'll give it a try! The first thing I'd say is don't worry if you don't get it at first, it took me a while to wrap my head around it too.
Do you remember when you were at school and you learn about reading long lines of numbers? I was taught like this:
1000's 100's 10's 1's
The number on the left is the number of 1000's, then 100's, then 10's, then 1's. You can apply a similar approach to binary.
First of all, remember that binary only understands 0's and 1's - you can think of 0 as being "off" and 1 as being "on". If a binary digit is 0 then the switch is "off" and the value in that column is 0. If the binary digit is 1 then the switch is "on" and the value in the column can be added to the total value:
Let's start with a 4 bit chain, just because it's small and easier to understand.
The first bit on the right represents 2 to the power of 0, which is 1. The next column over is 2 to the power of 1, which is 2. The next column is 2 to the power of 2, which is 4. The next column over is 2 to the power of 3, which is 8.
So it would look like this:
2^3 2^2 2^1 2^0 0 1 1 0 = 2^2(4) + 2^1 (2) = 6
Another way to think of this is the next column to the left is the next number you can't make with your existing bits. so if they're all turned on, how much does the sum of all the bits equal? The most you can make with 4 bits is 15. So the next bit you add would equal 16 (or 2^4). You can now make 16 by writing the binary word 10000.
I hope that makes some sense.
Here's a fun game using light bulbs to represent the bits that might help make things a bit more clear: http://cdn.cs50.net/2015/fall/psets/0/pset0/bulbs.html
Joseph Mathew
264 PointsJennifer Nordell, Nekilof, Stephen Shine....Thank You :)
One link lead to another and I somehow stumbled upon the below explanation
128 - 64 - 32 - 16 - 8 - 4 - 2 - 1
So if you have a binary number like 00000111 you could think of it like:
off - off - off - off - off - on - on - on, then just take the numbers that are "on" and add them up.
So, 4 + 2 + 1 = 7
What I'm unable to wrap my head around is, how does one read/ interpret/ break down these (eg. 2^0, 2^4, 2^6) in 0's and 1's.
Sorry for being a real pain, but I can't seem to make myself understand this :(
Stephen Shine
5,991 PointsThe ^ means "to the power of". This means multiplying 2 by itself that number of times. You've pretty much explained it yourself above. 2^0=1 (I can't explain why, just know everything to the power of 0 is 1). 2^1=2, 2^2 (or 2x2) = 4. Etc...
Once you get your head round this you'll be able to understand all other forms of notation like octal and hexadecimal. Keep at it!
A X
12,842 PointsA X
12,842 PointsMore of a Leonard fan myself, but my mom calls me "Mini-Cooper" because I act a fair bit like Sheldon...but not quite :)