understanding binary
Moderator: General Moderators
- shiznatix
- DevNet Master
- Posts: 2745
- Joined: Tue Dec 28, 2004 5:57 pm
- Location: Tallinn, Estonia
- Contact:
understanding binary
i need to know how to put a number into binary and read a number that is in binary. can anyone show me to a good tutorial on how this works?
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
well.. let class begin:
Wikipedia has [a] really nice article(s) on binary for further reading: http://en.wikipedia.org/wiki/Binary_numeral_system
- Binary is a number system based twos. We count (normally) in base ten, as in our digits go from zero through ten, whereas binary's is only zero and one. Standard notation of binary is often done in groups of four. Just like our normal counting, the farther left a digit is, the more significance it has. Each place in binary multiplies the previous by two: one bit has two possibilities; two bits have four; three, eight; and so forth. A group of four bits are called a nibble. Two nibbles make a byte. Two bytes, a word. Two words, a double-word. Two double-words, a quad-word. 1024 bytes, a kilobyte.
Now, lets look at some binary and some of those terms:The zeroth (or least significant) bit is considered bit one most often, since we typically start counting from one.Code: Select all
a word high low bytes high low high low nibbles +---------+---------+---------+---------+ | 1 1 1 1 | 1 1 | | | | 5 4 3 2 | 1 0 9 8 | 7 6 5 4 | 3 2 1 0 | bit number +---------+---------+---------+---------+ | 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 | 10 (base 10), 0x0A (base 16, or hexidecimal) | 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 | 255 (base 10), 0xFF (base 16) +---------------------------------------+
Now, to find out what a number would be in binary, simply find the highest power of two that falls underneath that value. Repeat this process on each successive value. Those are the bits you need to mark as ones. Lets take the decimal value of 10, for example. 2^4 = 16, so that's too high. 2^3 = 8, it fits, so we mark that as a one. We must now find the next power of two that fits the new result: 10 - 8 = 2. And 2^1 = 2, so that bit's marked. 2 - 2 = 0, so we don't have any more bits to mark!
Wikipedia has [a] really nice article(s) on binary for further reading: http://en.wikipedia.org/wiki/Binary_numeral_system
- evilmonkey
- Forum Regular
- Posts: 823
- Joined: Sun Oct 06, 2002 1:24 pm
- Location: Toronto, Canada
- shiznatix
- DevNet Master
- Posts: 2745
- Joined: Tue Dec 28, 2004 5:57 pm
- Location: Tallinn, Estonia
- Contact:
got it down, next question. now sorry but this is a very vague question but this is what was on the board. please remember that i am going to school at a non english speaking college so that is why its really hard to learn in class until i can fully understand the language.
it went somtin like this

once again, sorry it looks real strange but if someone knows what that is and where I can learn it then please point me there. thanks
edit: whoa that looks bad, ill put a picture up in a second hold on
edit2: there
it went somtin like this

once again, sorry it looks real strange but if someone knows what that is and where I can learn it then please point me there. thanks
edit: whoa that looks bad, ill put a picture up in a second hold on
edit2: there
- evilmonkey
- Forum Regular
- Posts: 823
- Joined: Sun Oct 06, 2002 1:24 pm
- Location: Toronto, Canada
No idea what that table means. It looks a lot like a "truth table". However, if that's true, then the table should look similar to this
(At least that's how every truth table I've seen is set up).
My guess is 'v' means false, though I don't know why there's a 'v' in the equation.
Code: Select all
A B C (-A || -B) -(B & C)
T T T F F
T T F F T
T F T T TMy guess is 'v' means false, though I don't know why there's a 'v' in the equation.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.