MGMT 1030 Lecture Notes - Lecture 28: Subtraction, Modular Arithmetic

15 views2 pages
MGMT 1030 Lecture 28 Notes Borrowing from the Modules
Introduction
We could correct for this situation on the chart by moving left an additional count any
tie the sutatio euies ooig fo the odulus.
Fo eaple, sutatig 00 − 00 euies teatig the alue 00 as though it ee
1200 to stay within the 0999 range.
The borrow can be used to indicate that an additional unit should be subtracted.
Next, consider the situation shown
In this case, counting to the right, or adding, also results in crossing the modulus
So an additional count must be added to obtain the correct result.
This is an easier situation, however.
Since the result of any sum that crosses the modulus must initially contain a carry digit
(the 1 in 1099 in the diagram), which is then dropped in the modular addition
It is easy to tell when the modulus has been crossed to the right.
We can then simply add the extra count in such cases.
This leads to a simple procedure for adding to ues i 9s opleeta
arithmetic
Add the two numbers.
If the result flows into the digit beyond the specified number of digits, add the carry into
the result.
This is known as end-around carry.
Notice that the result is now correct for both examples.
Although we could design a similar algorithm for subtraction, there is no practical
reason to do so.
Instead, subtraction is performed by taking the complement of the subtrahend (the item
being subtracted) and adding to the minuend (the item being subtracted from).
In this way, the computer can use a single addition algorithm for all cases.
There is one further consideration.
find more resources at oneclass.com
find more resources at oneclass.com
Unlock document

This preview shows half of the first page of the document.
Unlock all 2 pages and 3 million more documents.

Already have an account? Log in

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents