TExcelTAD
Home › Basic Math & Pre-Algebra › Dividing Decimals

Dividing Decimals

Dividing by a decimal becomes ordinary long division once you move the decimal points so the divisor is a whole number. This lesson shows that trick, dividing by powers of ten, what happens when a division never ends, and how to split money fairly in code without losing a cent.

Make the divisor a whole number

Multiplying both numbers in a division by the same amount does not change the answer (it is the same idea as equivalent fractions):

4.5÷0.15=4.50.15=4.5×1000.15×100=45015=304.5 \div 0.15 = \frac{4.5}{0.15} = \frac{4.5 \times 100}{0.15 \times 100} = \frac{450}{15} = 30

So: move the point in the divisor right until it is a whole number, and move the point in the dividend right by the same number of places (adding zeros if needed). Then divide.

Problem Shift both by Becomes Answer
4.5÷0.154.5 \div 0.15 2 places 450÷15450 \div 15 30
7.2÷0.87.2 \div 0.8 1 place 72÷872 \div 8 9
0.36÷0.0040.36 \div 0.004 3 places 360÷4360 \div 4 90
12.6÷312.6 \div 3 none 12.6÷312.6 \div 3 4.2

When the divisor is already whole (12.6÷312.6 \div 3), divide normally and put the point in the answer straight above the point in the dividend:

text
     4.2
   ┌────
 3 │12.6
    12
     ─
     0 6
       6
       ─
       0

Tip: Dividing by a number less than 1 makes the result bigger: 4.5÷0.15=304.5 \div 0.15 = 30. You are asking how many 0.15s fit into 4.5, and many small pieces fit.

Dividing by 10, 100, 1000

Each factor of 10 moves the point one place left: 52.7÷10=5.2752.7 \div 10 = 5.27, 52.7÷1000=0.052752.7 \div 1000 = 0.0527. This is the reverse of multiplying.

Divisions that never end

Some divisions stop (1÷8=0.1251 \div 8 = 0.125), others repeat forever (1÷3=0.333…1 \div 3 = 0.333\ldots). A decimal stops exactly when the fraction in lowest terms has a denominator made only of 2s and 5s, the prime factors of 10. More on this in Rounding and Repeating Decimals.

Decimal stops after a fixed number of significant digits (28 by default), and you can change the precision locally:

python · try it yourself
from decimal import Decimal as D, localcontext

print(D("4.5") / D("0.15"))
print(D("12.6") / 3)
print(D(1) / D(8))
print(D(1) / D(3))           # 28 significant digits by default

with localcontext() as ctx:
    ctx.prec = 6
    print(D(1) / D(3), D(200) / D(7))
3E+1
4.2
0.125
0.3333333333333333333333333333
0.333333 28.5714

Surprise: D("4.5") / D("0.15") printed 3E+1. That is scientific notation for 3×101=303 \times 10^1 = 30. Decimal keeps track of how many digits are significant and chose that form; .normalize() or formatting with f"{x:f}" gives the plain 30.

Note: localcontext() changes precision only inside the with block. Changing getcontext().prec globally affects every later calculation in the program, which is easy to forget.

Splitting a bill fairly

Divide 100.00 between 3 people: 100÷3=33.333…100 \div 3 = 33.333\ldots A computer cannot pay 33.333… each, and rounding everyone to 33.33 loses a cent (3×33.33=99.993 \times 33.33 = 99.99). The standard fix is to work in whole cents, divide with remainder, and give the leftover cents to the first people:

python · try it yourself
from decimal import Decimal

def split(total, people):
    cents = int(total * 100)
    share, extra = divmod(cents, people)
    parts = [share + 1 if i < extra else share for i in range(people)]
    return [Decimal(p) / 100 for p in parts]

for total, n in [(Decimal("100.00"), 3), (Decimal("59.99"), 4), (Decimal("10.00"), 6)]:
    parts = split(total, n)
    print(total, "/", n, "->", [str(p) for p in parts], " sum:", sum(parts))
100.00 / 3 -> ['33.34', '33.33', '33.33']  sum: 100.00
59.99 / 4 -> ['15', '15', '15', '14.99']  sum: 59.99
10.00 / 6 -> ['1.67', '1.67', '1.67', '1.67', '1.66', '1.66']  sum: 10.00

The sums always match the total. (Dividing an integer Decimal by 100 gives 15 rather than 15.00; for display you would format with two places.)

In software

  • Bill splitting, instalments and pro-rata refunds all need the "divide, then distribute the remainder" pattern. Libraries call it allocation (for example Money.allocate in many money libraries).
  • Averages: mean=total÷count\text{mean} = \text{total} \div \text{count} is a division that usually does not end; decide the precision you report.
  • Rates per unit: price per 100 g, cost per click, bytes per second. These are divisions where the divisor is often a decimal.

Exercises

Exercise 1: Shift the points

Compute 2.88÷0.122.88 \div 0.12.

Answer

24

Solution
2.88÷0.12shift both by 2 places288÷12=242.88 \div 0.12 \qquad \text{shift both by 2 places} \qquad 288 \div 12 = 24

Check: 24×0.12=2.8824 \times 0.12 = 2.88.

Exercise 2: Long division with a decimal answer

Compute 9.45÷79.45 \div 7.

Answer

1.35

Solution

The divisor 7 is already whole. 9÷7=1 r 29 \div 7 = 1 \text{ r } 2; bring down 4: 24÷7=3 r 324 \div 7 = 3 \text{ r } 3; bring down 5: 35÷7=5 r 035 \div 7 = 5 \text{ r } 0. With the point above the point: 1.35. Check: 1.35×7=9.451.35 \times 7 = 9.45.

Exercise 3: Unit price

A 0.75 kg bag of coffee costs 13.50. What is the price per kilogram?

Answer

18.00 per kg

Solution
13.50÷0.75shift by 21350÷75=1813.50 \div 0.75 \qquad \text{shift by 2} \qquad 1350 \div 75 = 18

Exercise 4: Split a subscription

A team of 7 shares a 250.00 yearly subscription. Use the split idea from the lesson to print each share with two decimals, and check the sum.

Answer

Three people pay 35.72 and four pay 35.71; the sum is 250.00.

Solution

25000 cents÷7=3571 remainder 325000\ \text{cents} \div 7 = 3571 \text{ remainder } 3, so 3 people get one extra cent (3572) and the other 4 get 3571:

python · try it yourself
cents, n = 25000, 7
share, extra = divmod(cents, n)
parts = [share + 1 if i < extra else share for i in range(n)]
print([f"{p / 100:.2f}" for p in parts], f"sum: {sum(parts) / 100:.2f}")
['35.72', '35.72', '35.72', '35.71', '35.71', '35.71', '35.71'] sum: 250.00

Check: 3×35.72+4×35.71=107.16+142.84=250.003 \times 35.72 + 4 \times 35.71 = 107.16 + 142.84 = 250.00.

Test yourself

What is 6.3÷0.96.3 \div 0.9?

  1. 0.7
  2. 70
  3. 7
  4. 5.67

Which fraction gives a decimal that ends (terminates)?

  1. 13\frac{1}{3}
  2. 16\frac{1}{6}
  3. 340\frac{3}{40}
  4. 27\frac{2}{7}

10.00÷3=3.333…10.00 \div 3 = 3.333\ldots If each of 3 people pays the rounded share 3.33, the total collected is…

  1. 10.00
  2. 9.99
  3. 10.01
  4. 9.00