Page 1 of 1
understanding binary
Posted: Thu Sep 08, 2005 1:08 am
by shiznatix
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?
Posted: Thu Sep 08, 2005 1:10 am
by feyd
know personally, or the functions?
Posted: Thu Sep 08, 2005 1:24 am
by shiznatix
huh? i have to understand binary for school. just like being able to put the number 50 into binary and being able to see the binary of 178 and putting it into the number. just a basic understanding of how binary would work.
Posted: Thu Sep 08, 2005 1:55 am
by feyd
well.. let class begin:
- 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: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)
+---------------------------------------+
The zeroth (or least significant) bit is considered bit one most often, since we typically start counting from one.
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! 
Well that's the super basics.. I can go other addition and subtraction if you'd like later.
Wikipedia has [a] really nice article(s) on binary for further reading:
http://en.wikipedia.org/wiki/Binary_numeral_system
Posted: Thu Sep 08, 2005 4:34 am
by timvw
The wikipedia explains everything fairly well..
Things to pay attention to:
- floating numbers conversion. (Fe: try to convert 0.1 decimal to binary)
- multiplication/division by 2. (In binary representation all you need to do is shift left or right)
Posted: Thu Sep 08, 2005 8:00 am
by $var
256 bits
128 64 32 16 4 2 1 0
so
01000100 = 68
00010000= 32
Posted: Thu Sep 08, 2005 9:02 pm
by evilmonkey
Yup, and convert back, you simply add up the amount of 1's in the proper places. For instance, "10" is 2, "110" is 6 (the first 1 is 4, second 1 is 2, 2+4=6), and so fourth.
Posted: Fri Sep 09, 2005 10:10 am
by shiznatix
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
Posted: Fri Sep 09, 2005 11:14 am
by feyd
they seem like bit marks, but I have no idea how they are interacting with that equation, as the results don't make a lot of sense.
Posted: Fri Sep 09, 2005 12:13 pm
by Weirdan
discrete math perhaps...
btw, shiznatix, do you speak russian? There's a quite a bit of awesome math resources available on the internet I'm aware of, but I used to bookmark only russian ones...
Posted: Fri Sep 09, 2005 9:14 pm
by evilmonkey
Are you an English native-speaker at an Estonian college? I speak Russian too, but probably not well enough to decipher descrete math in it.

Posted: Sat Sep 10, 2005 11:44 am
by pickle
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
Code: Select all
A B C (-A || -B) -(B & C)
T T T F F
T T F F T
T F T T T
(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.