How tf does binary code work.

634 views

it’s just a bunch of 0’s and 1’s.. like I can just put a bunch of them and somehow make a sentence??? like what does this mean -> 010100101001010010 (i legit just spammed 0’s and 1’s)

In: 0

26 Answers

Anonymous 0 Comments

Multi-part answer:

1. Everything a computer does or stores (or where it is stored) can be represented by a (sequence of) number. “G” is a number. “ADD X Y” is a number. The place in memory where the result of ADD X Y is stored is a number.
2. Numbers can be represented using different symbols in a particular order. In normal use, we have the 10 “arabic” symbols: 0,1,2,3,4,5,6,7,8,9. This is known as “decimal,” or “base 10.” And the meaning of each numeral depends on where in the sequence it is. So numerals that just represent units are the furthest to the right, numerical representing the number of 10’s is second to the right, 100s is 3rd from the right, 1000s is 4th from the right, and so forth. You can remember this because 10^(0)=1, 10^(1)=10, 10^(2)=100, 10^(3)=1000, and so forth. When we see a number like 1234, we interpret it as 4 units + 3 x *10* units *+ 2 x* 100 units + 1 x 1000 units = 1,234.
3. Binary is doing the **exact same thing**, except that there are only two symbols, 0 and 1. But because there are only two symbols, the value of each position is powers of 2. So the first position is units, the second is 2^(1) = 2, the third is 2^(2) = 4, then 2^(3) = 8, then 2^(4) = 16, and so forth. Each digit is known as a *bit*, so if a number has 4 bits, then 1011 is equivalent to 1 unit + 1 “2 units” + 0 “4 units” + 1 “8 units” = 11. So any sequence of 0’s and 1’s represents a number. And it’s **exactly** the way we usually use base 10 numbers, except that each place is a power of 2 instead of a power of 10.
4. OK, so you see a really, really long sequence of 0’s and 1’s. On an 8-bit system, each number 8 8 0/1 “bits” long. An 8-bit number can represent 256 different numbers. A 16-bit system uses 16 0/1 bits to represent 65536 different numbers, and so forth. While the computer may interpret numbers as these massively long sequences of 0/1, everything is being chopped up into the right number of bits and worked on together.

BONUS part: People can’t really do anything with 0’s and 1’s. They all start to look the same and your eyes start to hurt starting at them. Is there an easier way to still kind of work in binary (powers of 2), with something easier to look at? Yes, the **hexadecimal** number. Instead of representing the numbers 0 to 15 with a sequence of 4 0/1’s, why not use 16 symbols and work in “base 16?” Since 16 is a power of 2, it’s easy to line up a base 16 number with a base 2 number, except that it’s shorter. What are these 16 symbols? The standard 0-9 arabic numbers, along with symbols A, B, C, D, E, and F for 10-15.. When you see a number that looks like, say, 3BE4, that is equal to 3*4096 + 11*256 + 14*16 + 4 = 15332 in decimal, or 0011 1011 1110 0100 in binary? How do I know that’s the binary equivalent of 3BE4? Because 0011 = 3 in decimal/hex, 1011=11 in decimal, which is B in hex, 1110 is 14 in decimal, which is E in hex, and 0100 is 4 in decimal/hex. A 8-bit number can be “compressed” into just two hexadecimal symbols, and a 16-bit number can be represented as 4 hex symbols.

You are viewing 1 out of 26 answers, click here to view all answers.