Long division calculator

:

Case 1. The dividend is greater than or equal to the divisor

Before dividing, check that the divisor is nonzero. Work with absolute values. Give a nonzero quotient a minus sign if the original signs differ. The calculator displays at most six fractional digits unless it finishes sooner.

Algorithm

  1. Find the first partial dividend. Read the digits of the dividend from left to right until the resulting number is greater than or equal to the divisor. Underline this group of digits.
  2. Determine the number of digits in the integer part of the quotient. Put one placeholder dot in the quotient for the first partial dividend and one for each remaining digit of the dividend.
  3. Find the next quotient digit. Determine how many whole times the divisor fits into the partial dividend. Write that digit in place of the corresponding dot. If the partial dividend is less than the divisor, write 0.
  4. Multiply and subtract. Multiply the quotient digit by the divisor. Write the product beneath the partial dividend, aligning the place values, and subtract. This gives the remainder.
  5. Bring down the next digit. If there are digits left in the dividend, bring one down next to the remainder and repeat steps 3–5. Continue until every original digit has been processed, even if a remainder is zero.
  6. Finish the division or move to the decimal part. If all original digits have been processed and the remainder is zero, the division is complete. Otherwise, put a decimal point in both the quotient and the dividend, append a zero to the dividend, and bring it down next to the remainder. Repeat division, multiplication and subtraction, appending one zero at a time until the remainder is zero or a repeating decimal is identified.

Case 2. The dividend is less than the divisor

Algorithm

  1. Determine the integer part of the quotient. If the positive dividend is less than the divisor, the quotient is greater than 0 and less than 1. Write 0 as the integer part of the quotient.
  2. Perform the first subtraction. Multiply 0 by the divisor and subtract the product from the dividend. The remainder equals the dividend.
  3. Move to the decimal part. Put a decimal point in both the quotient and the dividend. Append a zero to the dividend and bring it down next to the remainder to form a new partial dividend.
  4. Find the next quotient digit. Determine how many whole times the divisor fits into the new partial dividend. Write that digit in the decimal part of the quotient. If the partial dividend is less than the divisor, write 0.
  5. Multiply and subtract. Multiply the quotient digit by the divisor. Write the product beneath the partial dividend and subtract it.
  6. Check the remainder. If the remainder is zero, the division is complete. Otherwise, append another zero to the dividend, bring it down next to the remainder, and repeat steps 4–6 until the remainder is zero or a repeating decimal is identified.