سؤال

From this MIT handout on number system:

Decimal subtraction works very similar to decimal addition, the numbers are aligned to the same place values and the algorithm proceeds from right to left. The bottom digit is subtracted from the top digit, and the result written in the place value position in the result. If the top digit is less than the bottom digit, then we must 'borrow' from the next place value position. That means decrementing the top digit in the next significant position and adding the base to the top digit of this position before performing the subtraction. This operation gets even more complicated when there is a ‘0’ in the next significant position.

What confuses me is the second last line in the paragraph. Can someone please explain the meaning of decrementing the top digit in the next significant position and adding the base to the top digit of this position before performing the subtraction.

هل كانت مفيدة؟

المحلول

...and adding the base to the top digit of this position before performing the subtraction.

In base 10, it means you decrement the top digit to the left of the current column, then add 10 to the top value in the current column.

For example, in the following subtraction:

 21  
-19
---

In order to subtract in the ones column, I'd have to borrow from the tens column, so I'd decrement the tens column and add 10 to the 1 in the top ones column. It's probably more familiar if you see it written out like:

 1 11  
-1  9
-----
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top