Module 13 - Introduction to Number Systems and Logic |
||||||||||||||||||||||||||||||||||||||||||||||||||
Module 13 − Introduction to Number Systems and Logic Pages i, 1−1, 1−11, 1−21, 1−31, 1−41, 1−51, 1−61, 2−1, 2−11, 2−21, 2−31, 3−1, 3−11, 3−21, 3−31, 3−41, Index
Step 3 - Rewrite the solution from MSD to LSD:
101112
No matter how large the decimal number may be, we use the same procedure. Let's try the problem below. It has a larger dividend:
We can convert fractional decimal numbers by multiplying the fraction by the radix and extracting the portion of the product to the left of the radix point. Continue to multiply the fractional portion of the previous product until the desired degree of accuracy is attained.
1-41 Let's go through this process and convert 0.2510 to its binary equivalent:
The first figure to the left of the radix point is the MSD, and the last figure of the computation is the LSD. Rewrite the solution from MSD to LSD preceded by the radix point as shown:
.012
Now try converting .62510 to binary:
As we mentioned before, you should continue the operations until you reach the desired accuracy. For example, convert .42510 to five places in the binary system:
1-42 Although the multiplication was carried out for seven places, you would only use what is required. Write out the solution as shown:
.011012
To convert a mixed number such as 37.62510 to binary, split the number into its whole and fractional components and solve each one separately. In this problem carry the fractional part to four places. When the conversion of each is completed, recombine it with the radix point as shown below:
3710 = 1001012
.62510 = .10102
37.62510 = 100101.10102
Convert the following decimal numbers to binary:
Q48. 7210.
Q49. 9710.
Q50. 24310.
Q51. 0.87510 (four places).
Q52. 0.3310 (four places).
Q53. 17.4210 (five places)
Decimal to Octal
The conversion of a decimal number to its base 8 equivalent is done by the repeated division method. You simply divide the base 10 number by 8 and extract the remainders. The first remainder will be the LSD, and the last remainder will be the MSD.
Look at the following example. To convert 1510 to octal, set up the problem for division:
Since 8 goes into 15 one time with a 7 remainder, 7 then is the LSD. Next divide 8 into the quotient (1). The result is a 0 quotient with a 1 remainder. The 1 is the MSD:
1-43 Now write out the number from MSD to LSD as shown:
178
The same process is used regardless of the size of the decimal number. Naturally, more divisions are needed for larger numbers, as in the following example:
Convert 26410 to octal:
By rewriting the solution, you find that the octal equivalent of 26410 is as follows:
4108
To convert a decimal fraction to octal, multiply the fraction by 8. Extract everything that appears to the left of the radix point. The first number extracted will be the MSD and will follow the radix point. The last number extracted will be the LSD.
Convert 0.0510 to octal:
1-44 Write the solution from MSD to LSD:
.031468
You can carry the conversion out to as many places as needed, but usually four or five places are enough.
To convert a mixed decimal number to its octal equivalent, split the number into whole and fractional portions and solve as shown below:
Convert 105.58910 to octal:
Combine the portions into a mixed number:
151.45548
Convert the following decimal numbers to octal:
Q54. 710
1-45 Q55. 4310
Q56. 49910
Q57. 0.95110 (four places).
Q58. 0.00410 (five places).
Q59. 252.1710 (three places).
Decimal to Hex
To convert a decimal number to base 16, follow the repeated division procedures you used to convert to binary and octal, only divide by 16. Let's look at an example:
Convert 6310 to hex:
Therefore, the hex equivalent of 6310 is 3F16.
You have to remember that the remainder is in base 10 and must be converted to hex if it exceeds 9. Let's work through another example:
Convert 17410 to hex:
1-46 Write the solution from MSD to LSD:
AE16
There will probably be very few times when you will have to convert a decimal fraction to a hex fraction. If the occasion should arise, the conversion is done in the same manner as binary or octal. use the following example as a pattern:
Convert 0.69510 to hex:
The solution: .B1EB16
Should you have the need to convert a decimal mixed number to hex, convert the whole number and the fraction separately; then recombine for the solution.
Convert the following decimal numbers to hex:
Q60. 4210.
Q61. 8310.
Q62. 17610 .
Q63. 49110.
Q64. 0.72110 (four places).
The converting of binary, octal, and hex numbers to their decimal equivalents is covered as a group later in this section.
1-47 BINARY CONVERSION
Earlier in this chapter, we mentioned that the octal and hex number systems are useful to computer programmers. It is much easier to provide data to a computer in one or the other of these systems. Likewise, it is important to be able to convert data from the computer into one or the other number systems for ease of understanding the data.
Binary to Octal
Look at the following numbers:
101110010011012
271158
You can easily see that the octal number is much easier to say. Although the two numbers look completely different, they are equal.
Since 8 is equal to 23, then one octal digit can represent three binary digits, as shown below:
With the use of this principle, the conversion of a binary number is quite simple. As an example, follow the conversion of the binary number at the beginning of this section.
Write out the binary number to be converted. Starting at the radix point and moving left, break the binary number into groups of three as shown. This grouping of binary numbers into groups of three is called binary-coded octal (BCO). Add 0s to the left of any MSD that will fill a group of three:
Next, write down the octal equivalent of each group:
1-48 To convert a binary fraction to its octal equivalent, starting at the radix point and moving right, expand each digit into a group of three:
Add 0s to the right of the LSD if necessary to form a group of three. Now write the octal digit for each group of three, as shown below:
To convert a mixed binary number, starting at the radix point, form groups of three both right and left:
Convert the following binary numbers to octal:
Binary to Hex
The table below shows the relationship between binary and hex numbers. You can see that four binary digits may be represented by one hex digit. This is because 16 is equal to 24.
1-49
Using this relationship, you can easily convert binary numbers to hex. Starting at the radix point and moving either right or left, break the number into groups of four. The grouping of binary into four bit groups is called binary-coded hexadecimal (BCH).
Convert 1110100112 to hex:
Add 0s to the left of the MSD of the whole portion of the number and to the right of the LSD of the fractional part to form a group of four.
Convert .1112 to hex:
In this case, if a 0 had not been added, the conversion would have been .716, which is incorrect. Convert the following binary numbers to hex:
1-50
|
||||||||||||||||||||||||||||||||||||||||||||||||||