Decimal Addition and Subtraction in Columns Calculator

Adding decimals

Algorithm

  1. Align the place values. Write the numbers under each other so that the decimal points line up. If they have different numbers of decimal places, append zeros on the right until they have the same number. This does not change their values.
  2. Add from right to left. Start with the rightmost digit and add the digits in the same column.
  3. Carry when needed. If the sum (including any incoming carry) is 10 or greater, write its ones digit and carry one to the next column on the left.
  4. Continue to the last column. If a carry remains after adding the leftmost column, write it on the left. Place the decimal point directly below the original decimal points.

Subtracting decimals

Algorithm

  1. Align the place values. Write the minuend and subtrahend under each other, with their decimal points aligned. Append missing zeros on the right.
  2. Subtract from right to left. Start with the rightmost column. If the top digit is at least as large as the bottom digit, subtract the bottom digit from the top digit.
  3. Borrow when needed. If the top digit is smaller, borrow one from the nearest nonzero digit on the left. One unit of the next higher place value equals ten units of the adjacent lower place value. When borrowing across zeros, the intervening zeros become nines. Subtract the bottom digit from the updated top value.
  4. Continue to the last column. Place the decimal point directly below the original decimal points. Remove unnecessary leading zeros, retaining the zero before the decimal point when the integer part is zero.

These algorithms describe calculations with nonnegative numbers. If the first number is smaller in subtraction, subtract the smaller number from the larger and put a minus sign before the result. For negative inputs, the calculator accounts for the signs before adding or subtracting the absolute values.