to count, we start cycling through them all. when we run out, we start using two digits at a time. when we run out of every possible 2-digit combination, we go to three.
so a number like 243 really means
2*10^2 + 4*10^1 + 3*10^0.
each position simply means a higher power of 10. why powers of 10? becuase we use decimal base.
if we used Octal base, we only get 8 digits (0-7), and we use powers of 8.
245 in octal means
2*8^2 + 4*8^1 + 3*8^0.
hexadecimal uses 16 digits. 0-9 and then a-f. you can see numbers like
2a7 which would mean
2*16^2 + 11*16^1 + 7*16^0
Originally posted by Guy Allard:
I recently saw this which describes teaching binary to 3rd graders using the Socratic method. I thought it was interesting.
That's pretty cool!
mert, you should skip down the page to where the questions start. I think the questions and answers will help you understand binary numbers.
Originally posted by mert �zkaya:
GArrret, I understood what you meant. But is there any advantage of using Binary for programmers ??
Two things come to mind:
- as the computer uses the binary system anyway, some oddities are easier to understand once you understand the binary system (for example, why 0.1 decimal can't be represented exactly in a float/double).
- you can "misuse" numbers as sets of booleans - by treating every bit of an int as a boolean, for example.
Originally posted by Garrett Rowe:
It seasier for computers to count in the binary system becausr there are only two states. 0 or 1, off or on, low voltage or high voltage. However you want o think of it. Think of a light switch, it only knows two states, either its off or its on. Its the same reasoning for computers working in the binary system. The computer doesnt have to, or need to keep track of ten different states (0 - 9) just two states (0 -1) off or on.
Can anyone give some examples about the hardwares??
Something that you might have occasion to do, as a programmer, is set up a bit-register of flags... what I mean is, maybe you have a one-byte (8-bit) set of flags, where each bit represents some toggle in your program....
Then, what you'd want to do is use the "bitwise" operators, OR, AND, XOR (exclusive or), or the bitwise complement. In java the operators are |, &, ^, ~, respectively.
Depending on if you wanted the flag to always toggle, only toggle if off, only toggle if on, etc. you'd use a different operation.
Now, as to the hardware issue, the way microchips work is by deciding if any message is a 1 or a 0 based upon voltage. You could make hardware that appeared to "think" in decimal, but it would be because you designed a hardware abstraction layer that obfusicated the binary qualities from the programmer... there really wouldn't be any point in doing this, as it would be cumbersome, and have less robust functionality than we currently have at our disposal.
At any rate mert appears to exhibit many troll like tendencies and behaviours. Just warning.
Compare this thread and http://forum.java.sun.com/thread.jspa?threadID=703144&messageID=4076946 for example.
Originally posted by mert �zkaya:
Yeah, Good diagnosis.
It is the rule of my Game...
Be happy , do not worry...
When you say "rule of my Game" I can only interpet that to mean that you are confirming that you are in fact a troll. You said this a couple of times at Sun along with "this is a joke".
I don't believe trolls are desired elements here.
And you just sent me a private message that I will be forwarding to a moderator that reads
"We are Muslim ,we are Turk.
We are not afraid of smo. "
Which I can only guess means you are a troll on a jihad. Lovely.