The Discordant Opposition Journal Issue 10 - File 8
What is a byte?
By: D|amond (pika)
When most people being to learn about low level things (around the API level or lower), they run into terms that they might not know. These terms are defined basically nowhere, because you're assumed to know them! When you don't know them your stuck in a pile of dog shit. You can't tell your friends you have no clue what they mean, so you're fucked! Read this and you'll know...
I won't tell nobody ;P
To start, we must explain numbering systems.
There are two general numbering systems you'll ever use: decimal, binary (im too lazy to explain hex;|, octal is ugly base 8, and some navigation requires base 60 or higher numbers!).
>decimal numbering system - puhh! 10 has always been an ugly number
Decimal is a numbering system of base 10. That means that each digit (place) can have one of ten values: 0, 1, 2, 3, 4, 5, 6, 7, 8, or 9 (when you count the 0 it's 10). The numbering system we use in our daily life is decimal. What we learn in school is decimal. For instance, when we see the number '1002', we think of the number one thousand and two. That is it's value using our normal decimal (base 10) numbering system. We use a numbering system with the base of ten because, whow, we have ten fingers! Some of those Romans must have been pretty fucking smart!
Each digit to the left of the decimal point (when there are no digits to the right of the decimal point (we will refer to it as the radix), it is usually left out (1 is equivalent to 1.000, eh?). Let's take 1002 again. The number 1002 is only equivalent to 1002 in decimal because you can do (1*10^3)+(0*10^2)+(0*10^1)+(2*10^0), or 1000 + 0 + 0 + 2 (remember, any number to the 0th power (the lowest digit (ones place)) is ALWAYS 1, except 0), because you can do it in your head! Because you've been taught mathematics using the base 10 numbering system. Every digit to the right of the radix (decimal) is to the -Nth power. So: 1002.2001 is (1*10^3)+(0*10^2)+(0*10^1)+(2*10^0)+(2*10^-1) +(0*10^-2)+(0*10^-3)+(1*10^-4), or 1000 + 0 + 0 + 2 + .2 + .00 + .000 + .0001.
>binary numbering system - pretty! base2=logic&pikalike logic!
Almost all modern computers explicitly use binary logic. This means that they say, internally, "1 = 1!" and "0 = 0". They determine whether a number is a 0 or a 1 by electrical 'impulses' (1 being +5 volts (+5v) and 0 being 0 volts (0v)) (ya like how i nest parenthesis?). With these two values (1 (on) and 0 (off)), two different values can be represented. Obviously, this is usually 'true and false', 'on and off', '1 and fucking 0'. Ironically, these two values, 0 and 1, corresponds to the computers using binary... fucking idiot (it's NOT a coincidence fool!). This is just like the decimal system, except each digit can only have two values: 0 and 1. Therefore, you have bizarre looking number like 1011, which is binary, and equals 11: (1*2^3)+(0*2^2)+(1*2^1)+(1*2^1).
This is:
(remember the rightmost digit is the 0th digit in all numbering systems)
(1*2^3) = 2^3 ([base of two] to the third digit (power)) = 8) * the value of the 3rd digit (1) = 1*8 = _8_
+
(0*2^2) = 2^2 ([base of two] to the second digit (power)) = 4) * the value of the 2nd digit (0) = 0*4 = _0_
+
(1*2^1) = 2^1 ([base of two] to the first digit (power)) = 2) * the value of the 1st digit (1) = 1*2 = _2_
+
(1*2^0) = 2^0 ([base of two] to the zeroth digit (power)) = 1) * the value of the 0st digit (1) = 1*1 = _1_
= 11 (eleven, not 3;P)!!!!
****So, to find the value of a binary digit, you use [(Nth digit value)*(2^(Nth digit))!****
So, you can count in binary as so: 0000, 0001, 0010, 0011, 0100, 0101, 0110, 0111, 1000, 1001, 1010, 1011, 1100, 1101, 1110, 1111 < that is binary up to 15 (each group of 4 binary "bits" can represent 16 different values (numbers) - including 0).
A binary value can extend to the left, with 0s, infinitely (eg. 0001 = 0000000000001). Just as decimal numbers, after passing 4 digits, each group of 3 digits are separated by commas (,), binary numbers' groups of 4 are separated by spaces (eg. 00000001 = 0000 0001)
Now to talk about binary terminology:
bit (binary digit): one of those 1s or 0s in a binary number (0 or 1) nibble: a group of 4 bits (0000, 0001, 0011, 0100, etc... (each byte can have 16 values))
= 4 bits
byte: a group of 8 bits! (two nibbles) (0000 0001, 0000 0010...etc)
= 8 bits, 2 nibbles
<nassssssssty groups of dataV
words: a group of 16 bits (two bytes) (0000 0000 0000 0001, 0000 0000 0000 0010...etc...)
= 16 bits, 4 nibbles, 2 bytes
double-words: a group of 32 bits (two words, whow!) (0000 0000 0000 0000 0000 0000 0000 0001...etc)
= 32 bits, 4 nibbles, 4 bytes, 2 words
- by pika