MGMT 1030 Lecture Notes - Lecture 28: Subtraction, Modular Arithmetic
![](https://new-preview-html.oneclass.com/Gy340B26qOkoN9bLwyDbQAdXzp1xr5w7/bg1.png)
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
tie the sutatio euies ooig fo the odulus.
• Fo eaple, sutatig 00 − 00 euies teatig the alue 00 as though it ee
1200 to stay within the 0–999 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 to ues i 9s opleeta
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