• Keine Ergebnisse gefunden

the cyclical nature of the number system. The only time

Im Dokument COMBAT DIRECTION CENTRAL (Seite 56-59)

BINARY ARITHMETIC

CH 4 the cyclical nature of the number system. The only time

it is required is when the minuend is larger than the subtrahend, that is, when the answer will come out a

true positive answer. Fortunately, whenever it is re-quired, there is a carry from the left-most position, which serves as a reminder.

EXAMPLES DIRECT SUBTRACT COMPLEMENT SUBTRACT

a. Minuend is +011011 Minuend 011011 Minuend

smaller than -101010 Subtrahend 010101 Subtrahend l's complement

subtrahend -001111 Difference 110000 Complement of difference

b. Minuend is +011011 Minuend 011011 Minuend

equal to -011011 Subtrahend 100100 Subtrahend l's complement

subtrahend 000000 Difference 111111 Complement of difference

c. Minuend is -011011 Minuend 100100 Complement of minuend

more negative -(-)010011 Subtrahend 010011 Subtrahend

than subtrahend -001000 Difference 110111 Complement of difference

and both are negative d. Minuend

is larger than subtrahend

011011 Minuend -010101 Subtrahend +000110 Difference (1)

-i

011011 Minuend

101010 Subtrahend l's complement 000101 True difference less 1

4.2.3.6 Generation of 2'5 Complements In the derivation of the complement system, it was shown that a 2's complement of a number is equal to th'e modulus minus the number, (M - N). Therefore, to obtain a 2's complement in a 6-place machine, the number is subtracted from the modulus, 1,000,000. As an example, find the 2's complement of the binary num-bers 101001(2) and 001101(2):

a. 1000 000 Modulus 101 001 Number

010 1112's complement of number b. 1000 000 Modulus

001 101 Number

110 011 2's complement of number

A close examination of the numbers and their com-plements will show that the 2' s complement of a num-ber is the same as the l's complement with a 1 added to

End carry ---~) (1)

000110 True difference

it. The 2's complement, therefore, may be formed by forming the l's complement and adding a 1 to it. As an example, form the 2's complement of 001101(2):

001101 Number

110010 l's complement of number 110011 2's complement of number 4.2.3.7 2'5 Complement Subtraction

To perform subtraction by the 2's complement method:

1. Find the 2's complement of the subtrahend.

2. Add this complement to the minuend.

The result is the difference in complement form if it is negative and in true form if it is positive. (Zero is con-sidered positive.)

In the 2's complement system, there is no need to end-around carry. The results will always be correct without it. For example, solve examples band d of 4.2.3.5 by the 2's complement system:

34 UNCLASSIFIED

PART 2 CH 4

UNCLASSIFIED T.O. 31 P2-2FSQ7-2

Binary Sign Conventions 4.2.3.7-4.2.3.9

EXAMPLE DIRECT SUBTRACT COMPLEMENT SUBTRACT

b. Minuend is 011011 Minuend 011011 Minuend

equal to subtrahend

-011011 Subtrahend 000000 Difference ( 1 )

101011 2's complement of subtrahend 000000 Difference

Discard

t

Carry

d. Minuend is 011011 Minuend 011011 Minuend

larger than subtrahend

-010101 Subtrahend 101011 2's complement of subtrahend 000110 True difference

+000110 Difference (1)

t

4.2.3.8 Binary Sign Conventions

At this point, it is natural to raise the question of how negative numbers in complement form can be dis-tinguished from positive numbers in true form. It turns out that in this regard, also, binary numbers offer an advantage with regard to representation. The sign of a number is binary in nature, that is, a number is either positive or negative with the exception of 0, which can be arbitrarily assigned a sign. Thus, a bit representing the sign can be used in addition to the bits representing magnitude. A 0 in the sign bit position can be inter-preted to mean that the number is positive and in true form; a 1 in the sign bit position can be interpreted to mean that the number is negative and in complement form. If the sign bits are assigned to the most signifi-cant bit position and are treated as a part of the num-ber in the addition operation, the resultant sign bit will be a true indication of the sign of the result. This sign operation is legitimate in both the l's and 2's comple-ment systems. In order to see how this works, four cases may be considered. The examples of subtractions listed in 4.2.3.5 are repeated below, with the sign bits added to illustrate the results of operating on sign bits in this manner. The sign bits are on the left, separated from the magnitude bits by a point (.). This is the usual practice.

Example:

a. Complement Subtraction 0.011011 Minuend

1.010101 l's complement of subtrahend 1.110000 l's complement of difference b. 0.011011 Minuend

1.100100 l's complement of subtrahend 1.111111 l's complement of difference (this

is often called negative zero)

Discard Carry

c. 1.100100 l's complement of minuend 0.010011 Subtrahend

1.110111 l's complenment of difference d. 0.011011 Minuend

1.101010 l's complement of subtrahend (1) 0.000101

~ End

Carry~l

0.000110

From the examples, it can be seen that a sign bit may be used in subtraction as though it were a magni-tude bit. It will then always indicate the sign. As a mat-ter of fact, the sign bit increases the capacity of the ma-chine twofold. This is because it allows the same num-ber of magnitude bits to signify both positive and nega-tive numbers.

4.2.3.9 Comparison of 1'5 and 2'5 Complement Subtraction

A study of the examples of 4.2.3.5 and 4.2.3.7 will show some of the advantages and disadvantages of the two systems. The chief advantage of the l's complement system is the ease with which the complement is formed~

Its chief disadvantage are the end-around carry opera-tions, sometimes necessary, and the fact that negtive zero must be provided for. It would appear that the l's complement system would be most suited to operations where the complementation process itself is a major part of the operation. The 2's complement process, on the other hand, would be advantageous in operations where the addition process is most important.

35

Binary Multiplication those of decimal multiplication. The rules for multiply-ing two smultiply-ingle digits are the same in both systems. These rules are:

OX 0=0

°X1=0

The general procedure when multiplying two· multiple digit binary numbers is the same as that in decimal arithmetic. That is, the multiplicand is multiplied by a digit of the multiplier, and the partial product obtained is placed so that the least significant digit is under the

Multiplicand 1010 10.11 1111

Multiplier 1101 100.1 1111

First Partial Product 1010 1011 1111

Second Partial Product 0000 0000 1111 Third Partial Product 1010 0000 0000 Fourth Partial Product 1010 1011 1111 Total Product 10000010 1100.011 11100001 Note the placement of the binary point in the second words, the largest product that can result frO'm the mul-tiplication of two numbers will be no longer than the sum of the number of bits in the multiplier and multi-plicand.

4.3.2 Add and Shift Multiplication

If a number is multiplied by the radix of the series of add and shift operations.

4.3.3 Multiplication (or Division) of Negative Numbers positive. Then when the multiplication (division) is fin-ished, the sign of the product (or quotient) is changed according to algebraic rules of multiplication (or divi-sion). subtracted from the dividend before a negative remain-der results is called the quotient.

PART 2 divisor is successively subtracted from the dividend (or

current remainder), the diviso" ;~ shifted to the right in relation to the binary point. In other words, the divi-sion process can be reduced to a process of successive subtract and shift steps.

4.4.3 Division by Subtraction and Shift Methods remainder. The nonrestoring technique does not do this; consequently, it is somewhat faster.

Division will always be built into a machine so the the divisor. The radix points of the divisor, divi-dend, and quotient are now properly oriented.

b. An attempt is made to subtract the divisor times the dividend (the dividend is restored).

c. The divisor is then shifted right one place and, below illustrates the division of the number 10001100(2) by 1110(2)'

UNCLASSIFIED

37

Im Dokument COMBAT DIRECTION CENTRAL (Seite 56-59)