Place
|
1st
|
0th
|
Digit
|
2
|
1
|
Exponential value of the place
|
41
|
40
|
Decimal value of the place
|
4
|
1
|
Table 2 Exponential and decimal values corresponding to a digit's place in a number
2(4)1 + 1(4)0 =
2× 4 + 1 × 1 =
8 + 1 =9
So far, we have only discussed converting numbers to decimal. It is also important to be able to convert numbers from decimal to other numbering systems. Continuing with the base4 system, let us convert 89 from decimal to base4.
First, find the value p, where 4p < = 89 < 4p+1. In this case p = 3. p is the value of the highest place.
Now we can proceed by filling out the following chart:
Place
|
3
|
2
|
1
|
0
|
Exponential value of the place
|
43
|
42
|
41
|
40
|
Decimal value of the place
|
64
|
16
|
4
|
1
|
Calculation
|
89 ÷ 64
|
25 ÷ 16
|
9 ÷ 4
|
1 ÷ 1
|
Result
|
1
|
1
|
2
|
1
|
Remainder
|
25
|
9
|
1
|
0
|
Table 3 Converting numbers from base 10 to base 4
Therefore, 8910 = 11214.
We are now going to review binary and hexadecimal more closely.
Binary
Since all numbering-systems are treated the same, you already have all the tools necessary to convert to and from binary. Let's review converting from binary to decimal the number 101101102.
The highest place, p, is obtained by counting the number of places in the binary number, starting from zero. In this case, p = 7.
1 × 27 + 0 × 26 + 1 × 25 + 1 × 24 + 0 × 23 + 1 × 22 + 1 × 21 + 0 × 20 =
1 × 128 + 0 × 64 + 1 × 32 + 1 × 16 + 0 × 8 + 1 × 4 + 1 × 2 + 0 × 1 =
128 + 0 + 32 + 16 + 0 + 4 + 2 + 0 =
182
For example, in 1001102 the largest place is 2p, where p = 5. Because binary is the easiest numbering system to convert into decimal, it will help us later when we are convert hexadecimal numbers.
Hexadecimal
You should notice that it takes more digits to express a value in binary notation than in decimal notation. For example, the number 99 in decimal is 1100011 in binary. Computer professionals have adopted hexadecimal notation as shorthand for binary so that they can express binary values more concisely.
Hexadecimal (base16), or "hex," is most likely the largest numbering system that you will work with. In the modern decimal system, the Arabic number set 0-9 has to be supplemented by additional values to represent the decimal equivalents of 10, 11, 12, 13, 14, and 15. Instead of inventing new symbols to represent these numbers, the letters A-F are used. Hexadecimal is represented by the set of numbers 0-F. While both lower case and upper case letters can be used in hexadecimal for A-F. In this course, we will use upper case A-F. Hexadecimal, however, is not usually represented by appending a 16 as a subscript to the number. There are two differing formats for representing hexadecimal numbers: prepending 0x or appending h. We will use 0x to denote hexadecimal numbers.
Do'stlaringiz bilan baham: |