Binary
Contents
Why We Need (why we use) Binary
Computers only have 2 states, or output options, and therefore can only use two symbols to represent those two states. More complicated questions are simply combining multiple yes and no questions in a series. The binary number system is thus useful in computing and it is the way how computers represent and store a value or a number.
Numbering Systems
While numbers seem like absolutes, there are actually several different ways to write these values. One main difference in numbering systems is what we use as the base of the number. The decimal system uses a base 10, meaning that there are 10 symbols (0-9) that are used. Once you get past 9, you round up to a 1 in the tens position and start over at 0 in the ones position. There are many other base systems, including Base 16 (hexabase), Base 8 (octobase), and Base 2 (binary). Base 8 only uses 8 symbols (0-7) and binary only uses 2 symbols (0-1). These base systems can still be used to represent the same numbers, and can be converted back and forth. Specifically converting between base 10 and base 2 (decimal to binary) is helpful.
The system you already understand very well is the decimal system, i.e. base 10, where we have 10 digits to describe any number (0,1,2,3,4,5,6,7,8,9). When keeping track of amounts larger than 9, multiple digits are necessary, where each digit represents a power of 10. For example, the number can be expanded to make this explicit:
Now consider the binary system, i.e. base 2, where we only use 2 digits to describe any value/number (0 and 1). When keeping track of values larger than 1, multiple digits are necessary, where each figit represents a power of 2. For example, the number can be expanded to make this explicit:
Decimal to Binary Conversion
Since we (as humans) have been trained to count and keep track of stuff using decimal numbers, and the computer needs to use binary numbers, it is useful to know how to convert between the two. For example, consider the decimal numbers 0 through 7, and the corresponding binary representation:
Binary | Decimal |
000 | 0 |
001 | 1 |
010 | 2 |
011 | 3 |
100 | 4 |
101 | 5 |
110 | 6 |
111 | 7 |
Put example here of dividing by 2, over and over, and keeping track of remainders, etc...
Binary to Decimal Conversion
ASCII
Binary Addition
add stuff here
(C.1) |
TESTING SECTION
Binary | Decimal |
000 | 0 |
001 | 1 |
010 | 2 |
011 | 3 |
100 | 4 |
101 | 5 |
110 | 6 |
111 | 7 |
Table B1: Examples of Binary/Decimal Correspondence.