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 2 - Now R's-1 complement the remaining digits:
Now let's R's complement the same number using both methods:
Now let's do some subtracting by using the R's complement method. We will go through the subtraction of 310 from 910 (00112from 10012):
Step 1 - Leave the minuend alone:
10012 remains 10012
Step 2 - Using either method, R's complement the subtrahend:
11012 R's complement of subtrahend
Step 3 - Add the R's complement found in step 2 to the minuend of the original problem:
1-21
Step 4 - Remember to discard any carry beyond the size of the original number. Our original problem had four digits, so we discard the carry that expanded the difference to five digits. This carry we disregard is significant to the computer. It indicates that the difference is positive. Because we have a carry, we can read the difference directly without any further computations. Let's check our answer:
If we do not have a carry, it indicates the difference is a negative number. In that case, the difference must be R's complemented to produce the correct answer.
Let's look at an example that will explain this for you.
Subtract 910 from 510 (10012 from 01012):
Step 1 - Leave the minuend alone:
01012 remains 01012
Step 2 - R's complement the subtrahend:
01112 R's complement of subtrahend
Step 3 - Add the R's complement found in step 2 to the minuend of the original problem:
Step 4 - We do not have a carry; and this tells us, and any computer, that our difference (answer) is negative. With no carry, we must R's complement the difference in step 3. We will then have arrived at the answer (difference) to our original problem. Let's do this R's complement step and then check our answer:
01002 R's complement of difference in step 3
Remember, we had no carry in step 3. That showed us our answer was going to be negative. Make sure you indicate the difference is negative. Let's check the answer to our problem:
1-22
Try solving a few subtraction problems by using the complement method:
Q21. Subtract:
Q22. Subtract:
Q23. Subtract:
OCTAL NUMBER System
The octal, or base 8, number system is a common system used with computers. Because of its relationship with the binary system, it is useful in programming some types of computers.
Look closely at the comparison of binary and octal number systems in table 1-3. You can see that one octal digit is the equivalent value of three binary digits. The following examples of the conversion of octal 2258 to binary and back again further illustrate this comparison:
1-23
Table 1-3. - Binary and Octal Comparison
Unit and Number The terms that you learned in the decimal and binary sections are also used with the octal system.
The unit remains a single object, and the number is still a symbol used to represent one or more units.
Base (Radix)
As with the other systems, the radix, or base, is the number of symbols used in the system. The octal system uses eight symbols - 0 through 7. The base, or radix, is indicated by the subscript 8.
Positional Notation
The octal number system is a positional notation number system. Just as the decimal system uses powers of 10 and the binary system uses powers of 2, the octal system uses power of 8 to determine the value of a number's position. The following bar graph shows the positions and the power of the base:
83 82 81 80 • -1 8-2 8-3
1-24 Remember, that the power, or exponent, indicates the number of times the base is multiplied by itself. The value of this multiplication is expressed in base 10 as shown below:
All numbers to the left of the radix point are whole numbers, and those to the right are fractional numbers.
MSD and LSD
When determining the most and least significant digits in an octal number, use the same rules that you used with the other number systems. The digit farthest to the left of the radix point is the MSD, and the one farthest right of the radix point is the LSD.
Example:
If the number is a whole number, the MSD is the nonzero digit farthest to the left of the radix point and the LSD is the digit immediately to the left of the radix point. Conversely, if the number is a fraction only, the nonzero digit closest to the radix point is the MSD and the LSD is the nonzero digit farthest to the right of the radix point.
Addition of Octal Numbers
The addition of octal numbers is not difficult provided you remember that anytime the sum of two digits exceeds 7, a carry is produced. Compare the two examples shown below:
1-25
The octal addition table in table 1-4 will be of benefit to you until you are accustomed to adding octal numbers. To use the table, simply follow the directions used in this example:
Add: 68 and 58
Table 1-4. - Octal Addition Table
Locate the 6 in the X column of the figure. Next locate the 5 in the Y column. The point in area Z where these two columns intersect is the sum. Therefore,
If you use the concepts of addition you have already learned, you are ready to add octal numbers. Work through the solutions to the following problems:
1-26 As was mentioned earlier in this section, each time the sum of a column of numbers exceeds 7, a carry is produced. More than one carry may be produced if there are three or more numbers to be added, as in this example:
The sum of the augend and the first addend is 68 with a carry. The sum of 68 and the second addend is 58 with a carry. You should write down the 58 and add the two carries and bring them down to the sum, as shown below:
Now let's try some practice problems:
Q24. Add:
Q25. Add:
1-27
Q26. Add:
Q27. Add:
Q28. Add
Q29. Add:
Subtraction of Octal Numbers
The subtraction of octal numbers follows the same rules as the subtraction of numbers in any other number system. The only variation is in the quantity of the borrow. In the decimal system, you had to borrow a group of 1010. In the binary system, you borrowed a group of 210. In the octal system you will borrow a group of 810.
Consider the subtraction of 1 from 10 in decimal, binary, and octal number systems:
1-28 In each example, you cannot subtract 1 from 0 and have a positive difference. You must use a borrow from the next column of numbers. Let's examine the above problems and show the borrow as a decimal quantity for clarity:
When you use the borrow, the column you borrow from is reduced by 1, and the amount of the borrow is added to the column of the minuend being subtracted. The following examples show this procedure:
In the octal example 78 cannot be subtracted from 68, so you must borrow from the 4. Reduce the 4 by 1 and add 108 (the borrow) to the 68 in the minuend. By subtracting 78 from 168, you get a difference of 78. Write this number in the difference line and bring down the 3. You may need to refer to table 1-4, the octal addition table, until you are familiar with octal numbers. To use the table for subtraction, follow these directions. Locate the subtrahend in column Y. Now find where this line intersects with the minuend in area Z. The remainder, or difference, will be in row X directly above this point.
Do the following problems to practice your octal subtraction:
Q30. Subtract:
Q31. Subtract:
1-29
Q32. Subtract:
Q33. Subtract:
Q34. Subtract:
Q35. Subtract:
Check your answers by adding the subtrahend and difference for each problem.
HEXADECIMAL (HEX) NUMBER System
The hex number system is a more complex system in use with computers. The name is derived from the fact the system uses 16 symbols. It is beneficial in computer programming because of its relationship to the binary system. Since 16 in the decimal system is the fourth power of 2 (or 24); one hex digit has a value equal to four binary digits. Table 1-5 shows the relationship between the two systems.
1-30
|
||||||||||||||||||||||||||||||||||||||||||||||||||