All data stored and processed by digital computers exist as binary (base 2) numbers. In the binary system, the only numbers are 0s and 1s. Whereas in the base 10 (or decimal) system, each position to the left of the decimal indicates an increased power of 10, in binary each place to the left signifies an increased power of 2. Therefore 2 to the first power is two, 2 to the second power is four, and so on.
The following table translates the base 10 numbers 0-15 into their binary equivalents. As can be seen, finding the decimal equivalent of a binary number is simply a matter of noting which place columns the binary 1s occupy, then adding up their values:
|
DECIMAL |
BINARY |
||||
|
Place 10 |
Place 1 |
Place 8 |
Place 4 |
Place 2 |
Place 1 |
|
0 |
0 |
0 |
0 |
0 |
|
|
1 |
0 |
0 |
0 |
1 |
|
|
2 |
0 |
0 |
1 |
0 |
|
|
3 |
0 |
0 |
1 |
1 |
|
|
4 |
0 |
1 |
0 |
0 |
|
|
5 |
0 |
1 |
0 |
1 |
|
|
6 |
0 |
1 |
1 |
0 |
|
|
7 |
0 |
1 |
1 |
1 |
|
|
8 |
1 |
0 |
0 |
0 |
|
|
9 |
1 |
0 |
0 |
1 |
|
|
1 |
0 |
1 |
0 |
1 |
0 |
|
1 |
1 |
1 |
0 |
1 |
1 |
|
1 |
2 |
1 |
1 |
0 |
0 |
|
1 |
3 |
1 |
1 |
0 |
1 |
|
1 |
4 |
1 |
1 |
1 |
0 |
|
1 |
5 |
1 |
1 |
1 |
1
|
Of course, numbers larger than 15 require more than four binary columns For example, the integer 238 is expressed in binary using eight binary digits or bits as:
11101110
or:
|
0 |
in the 1s |
0 |
|
1 |
in the 2s |
2 |
|
1 |
in the 4s |
4 |
|
1 |
in the 8s |
8 |
|
0 |
in the 16s |
0 |
|
1 |
in the 32s |
32 |
|
1 |
in the 64s |
64 |
|
1 |
in the l28s |
128 |
| ---- 238 |
Since the standard chunk of computer data consists of eight bits (a byte), the largest whole number (integer) a computer can handle one byte at a time is 11111111 or 255 (decimal). Integers larger than 255 require more than one byte of data.
Instead, larger integers (such as 35,232) and decimals or reals (such as 657.67) are handled using floating-point numbers. A floating-point number is similar to scientific notation, in which a number is expressed in two parts - the mantissa and the exponent. For example, in base 10 scientific notation 35,232 could be expressed as 3.52 x 104 (with 3.52 being the mantissa and 4 being the exponent). In addition to the mantissa and exponent, all binary floating-point numbers are also stored with a sign (+ or -), thus allowing for positive or negative values.
Binary arithmetic is essentially the same as with decimal numbers, except 1 + 1 in binary equals 0, with the one carried to the next column. For example, in binary math: 1+1=10 and 110+101=1011
© Craig L. Scanlan, 2001. Version 2.0 - January 2002. Original version January 2001.