04-23-2013, 01:07 AM
(This post was last modified: 04-28-2013, 04:31 PM by Guy1234567890.)
1. What is a numeral system?
A numeral system is a way of representing a number. There are three commonly used numeral systems: decimal, hexadecimal, and binary.
Think of the number five. Yes, we have this word ("five") and a symbol (5) which both represent that number. These are only two of many; in German, the word for five is fünf (alternate spelling fuenf), and maritime flags display five as this.
Imagine for a moment what that number really is - if you have five apples, is that not also a way of representing five? "Five" is really just a concept.
2. What is decimal?
We communicate this concept to one another using numeral systems. The number system that we are all no doubt most familiar with is called decimal. The root deci- means "ten", and our number system is based on ten for a reason - that's how many fingers that we have to count on.
Decimal has ten symbols, or numerals, that can represent numbers. They are, as you certainly know, 0-9. Because it has ten symbols you may also see it referred to as base ten.
Let's count in decimal:
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20...
This is obviously elementary to you, but let me point out the important factor: look at where nine becomes ten and where nineteen becomes twenty. Since we have ten numerals (0-9) and because one of them represents nothing (naught/zero), we run out of symbols at nine. What do we do when we run out of symbols?
Simple - we add another symbol next to it! This is called a decimal place or digit. When we get to nine, we increment the next decimal place by one (there is an infinite string of zeroes to the left of any number (we just don't write them) - we increment that zero to a one). Simultaneously, we reset all places to the right back to the smallest numeral we have (zero/naught).
Following this pattern, each decimal place to is worth one order of magnitude more than the one to its right. Since we are working with decimal (base ten), that means the order of magnitude is ten, making each digit worth ten times more than the one to its right. In school these were probably referred to as the "tens' place" and the "hundreds' place" and so on ad nauseam.
It is useful to note that, with n digits, the largest number we can represent is equal to 10^n - 1. Thus, with three decimal digits (base ten), we can represent all numbers from 0 through 10^3 - 1, which is all numbers between zero/naught and 999. If we want to represent 1000, we must add a fourth digit.
Now that we understand what numeral systems are and what decimal is we can begin to comprehend binary.
3. What is binary?
Binary, like decimal, is a numeral system used to represent the concept of numbers. You likely know that the prefix bi- means "two" - bicycle (two wheels), bisexual (two sexualities), bipartisan (two parties), et cetera. The core difference between binary and decimal is that while decimal has ten numerals, binary only has two: one and zero(1 and 0). For this reason, binary is also commonly known as base two.
It is this property of having only two symbols that makes binary valuable for computing. There is also ternary (base three - for a ternary computer, see Setun), but we won't go into that here.
When we represent five in binary, it looks like this: 101. This is meaningless unless we know what each decimal place (in binary, decimals are called bits, which means "binary digit") stands for.
To find out what value each bit has, we need to look at orders of magnitude. Binary has two numerals, which makes it base two, which makes our order of magnitude two. That means that each bit is worth twice as much as the bit to its right.
In a decimal system, the values of our digits (from right to left; smallest to largest) is 1, 10, 100, 1000, 10000, 100000, 1000000, and so on ad infinitum. You'll notice that each digit is worth ten times more because decimal is base ten. In binary, the values of each bit (again, right to left) are as follows: 1, 2, 4, 8, 16, 32, 64, and so forth.
Now that we know what each bit stands for, we can decode the number "101" - we must use the "fours' place" and the "ones' place". Four plus one equals five.
Let's count in binary: 0, 1, 10, 11, 100, 101, 110, 111, 1000, 1001, 1010, 1011, 1100, 1101, 1110, 1111.
Since we are using four bits and are in base two, the numbers that we can represent are naught through 2^4 - 1, meaning that we can represent 0-15 using only four bits. You may realize at this point that it requires significantly more numbers to represent large numbers in binary than it does in decimal, but again, the reason it is used is its simplicity.
Try looking at the following numbers represented in binary and seeing if you can comprehend them: twelve (1100), one hundred twenty-eight (10000000), and fifty-three (110101).
Twelve (1100) has a "one" in the "eights' place" and in the "fours' place". Eight plus four equals twelve.
One hundred twenty-eight (10000000) has a "one" in the "one hundred twenty-eights' place" and nothing in the rest.
Fifty-three (110101) has "ones" in the "thirty-twos' place", the "sixteens' place", the "fours' place", and the "ones' place". 32 + 16 + 4 + 1 = 53.
The concept of binary should be comprehensible to you at this point.
4. Why does binary matter?
Binary is the most convenient numeral system to use when computing. With electronic computation, there is high (1) and there is low (0). In real life, computers operate by detecting and changing the state of electricity (don't tell this to a computer engineer - it's simplified here to the point of being offensive).
Since you are reading this, you probably care about why binary matters in regards to redstone. Redstone is a similar case to that of real-life electronics; it has an on (1) and an off (0). These two states can be detected and can change, which allows creations such as adders and computers.
Computers can perform two kinds of operations on binary numbers - logical operations and arithmetic operations. People often talk about ALUs; the acronym stands for arithmetic logic unit.
The ALU, in most cases, can perform both logical and arithmetic operations. Logical operations are things like AND, OR, NOT, XOR, et cetera, while arithmetic operations are things like addition, subtraction, multiplication, et cetera. Logic operations get their names from someone named George Boole and his ideas, called Boolean Logic. Arithmetic operations, obviously, are arithmetic.
I hope this tutorial has helped you fledgling redstone engineers learn more about numeral systems and binary! Let me know if you need any further assistance.
A numeral system is a way of representing a number. There are three commonly used numeral systems: decimal, hexadecimal, and binary.
Think of the number five. Yes, we have this word ("five") and a symbol (5) which both represent that number. These are only two of many; in German, the word for five is fünf (alternate spelling fuenf), and maritime flags display five as this.
Imagine for a moment what that number really is - if you have five apples, is that not also a way of representing five? "Five" is really just a concept.
2. What is decimal?
We communicate this concept to one another using numeral systems. The number system that we are all no doubt most familiar with is called decimal. The root deci- means "ten", and our number system is based on ten for a reason - that's how many fingers that we have to count on.
Decimal has ten symbols, or numerals, that can represent numbers. They are, as you certainly know, 0-9. Because it has ten symbols you may also see it referred to as base ten.
Let's count in decimal:
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20...
This is obviously elementary to you, but let me point out the important factor: look at where nine becomes ten and where nineteen becomes twenty. Since we have ten numerals (0-9) and because one of them represents nothing (naught/zero), we run out of symbols at nine. What do we do when we run out of symbols?
Simple - we add another symbol next to it! This is called a decimal place or digit. When we get to nine, we increment the next decimal place by one (there is an infinite string of zeroes to the left of any number (we just don't write them) - we increment that zero to a one). Simultaneously, we reset all places to the right back to the smallest numeral we have (zero/naught).
Following this pattern, each decimal place to is worth one order of magnitude more than the one to its right. Since we are working with decimal (base ten), that means the order of magnitude is ten, making each digit worth ten times more than the one to its right. In school these were probably referred to as the "tens' place" and the "hundreds' place" and so on ad nauseam.
It is useful to note that, with n digits, the largest number we can represent is equal to 10^n - 1. Thus, with three decimal digits (base ten), we can represent all numbers from 0 through 10^3 - 1, which is all numbers between zero/naught and 999. If we want to represent 1000, we must add a fourth digit.
Now that we understand what numeral systems are and what decimal is we can begin to comprehend binary.
3. What is binary?
Binary, like decimal, is a numeral system used to represent the concept of numbers. You likely know that the prefix bi- means "two" - bicycle (two wheels), bisexual (two sexualities), bipartisan (two parties), et cetera. The core difference between binary and decimal is that while decimal has ten numerals, binary only has two: one and zero(1 and 0). For this reason, binary is also commonly known as base two.
It is this property of having only two symbols that makes binary valuable for computing. There is also ternary (base three - for a ternary computer, see Setun), but we won't go into that here.
When we represent five in binary, it looks like this: 101. This is meaningless unless we know what each decimal place (in binary, decimals are called bits, which means "binary digit") stands for.
To find out what value each bit has, we need to look at orders of magnitude. Binary has two numerals, which makes it base two, which makes our order of magnitude two. That means that each bit is worth twice as much as the bit to its right.
In a decimal system, the values of our digits (from right to left; smallest to largest) is 1, 10, 100, 1000, 10000, 100000, 1000000, and so on ad infinitum. You'll notice that each digit is worth ten times more because decimal is base ten. In binary, the values of each bit (again, right to left) are as follows: 1, 2, 4, 8, 16, 32, 64, and so forth.
Now that we know what each bit stands for, we can decode the number "101" - we must use the "fours' place" and the "ones' place". Four plus one equals five.
Let's count in binary: 0, 1, 10, 11, 100, 101, 110, 111, 1000, 1001, 1010, 1011, 1100, 1101, 1110, 1111.
Since we are using four bits and are in base two, the numbers that we can represent are naught through 2^4 - 1, meaning that we can represent 0-15 using only four bits. You may realize at this point that it requires significantly more numbers to represent large numbers in binary than it does in decimal, but again, the reason it is used is its simplicity.
Try looking at the following numbers represented in binary and seeing if you can comprehend them: twelve (1100), one hundred twenty-eight (10000000), and fifty-three (110101).
Twelve (1100) has a "one" in the "eights' place" and in the "fours' place". Eight plus four equals twelve.
One hundred twenty-eight (10000000) has a "one" in the "one hundred twenty-eights' place" and nothing in the rest.
Fifty-three (110101) has "ones" in the "thirty-twos' place", the "sixteens' place", the "fours' place", and the "ones' place". 32 + 16 + 4 + 1 = 53.
The concept of binary should be comprehensible to you at this point.
4. Why does binary matter?
Binary is the most convenient numeral system to use when computing. With electronic computation, there is high (1) and there is low (0). In real life, computers operate by detecting and changing the state of electricity (don't tell this to a computer engineer - it's simplified here to the point of being offensive).
Since you are reading this, you probably care about why binary matters in regards to redstone. Redstone is a similar case to that of real-life electronics; it has an on (1) and an off (0). These two states can be detected and can change, which allows creations such as adders and computers.
Computers can perform two kinds of operations on binary numbers - logical operations and arithmetic operations. People often talk about ALUs; the acronym stands for arithmetic logic unit.
The ALU, in most cases, can perform both logical and arithmetic operations. Logical operations are things like AND, OR, NOT, XOR, et cetera, while arithmetic operations are things like addition, subtraction, multiplication, et cetera. Logic operations get their names from someone named George Boole and his ideas, called Boolean Logic. Arithmetic operations, obviously, are arithmetic.
I hope this tutorial has helped you fledgling redstone engineers learn more about numeral systems and binary! Let me know if you need any further assistance.