Subtraction of Unsigned Numbers



Rating - 3/5
451 views

subtraction :

The direct method of subtraction taught in elementary schools uses the borrow concept. In this method we borrow a 1 from a higher significant position when the minuend digit is smaller than the corresponding subtrahend digit. This seems to be easiest when people perform subtraction with paper and pencil. When subtraction is implemented with digital hardware, this method is found to be less efficient than the method that uses complements.

The subtraction of two n-digit unsigned numbers M - N (N * 0) in base r can be done as follows:

1. Add the minuend M to the r's complement of the subtrahend N. This performs M + (r' - N) = M - N + r'.

2. If M "" N, the sum will produce an end carry r' which is discarded, and what is left is the result M - N.

These Topics Are Also In Your Syllabus
1 Register-Reference Instructions link
2 Memory-Reference Instructions link
You May Find Something Very Interesting Here. link
3 AND to AC link
4 ADD to AC link
5 LDA: Load to AC link

3. If M < N, the sum does not produce an end carry and is equal to r' - (N - M), which is the r's complement of (N - M). To obtain the answer in a familiar form, take the r' s complement of the sum and place a negative sign in front.

Consider, for example, the subtraction 72532 - 13250 = 59282. The lO's complement of 13250 is 86750. Therefore:

                               M = 72532

lO's complement of N = +86750

                          Sum = 159282

These Topics Are Also In Your Syllabus
1 ADD to AC link
2 LDA: Load to AC link
You May Find Something Very Interesting Here. link
3 STA: Store AC & BUN: Branch Unconditionally link
4 BSA: Branch and Save Return Address link
5 BSA: Branch and Save Return Address -subroutine call link

Discard end carry 10' = -100000

                      Answer = 59282

Now consider an example with M < N. The subtraction 13250 - 72532 produces negative 59282. Using the procedure with complements, we have

                                M = 13250 

lO's complement of N = +27468

These Topics Are Also In Your Syllabus
1 DECIMAL REPRESENTATION-INTRODCTION link
2 ALPHANUMERIC REPRESENTATION link
You May Find Something Very Interesting Here. link
3 Complements link
4 Complements -2 link
5 Subtraction of Unsigned Numbers link

                           Sum = 40718

There is no end carry.

Answer is negative 59282 = 10's complement of 40718


Rating - 3/5
506 views

Advertisements
Rating - 3/5