Index Ai Academy
Foundation · Foundation mathNumbers

Decimals and rounding

About 36 minLooking ahead: some prerequisites aren't done yet

Why this matters

A decimal is a fraction written in place value: 0.75 is 75 hundredths, the same as 3/4. Almost every number inside an AI model is a decimal, and almost every number in a report is rounded. This lesson shows what the digits after the point mean, how to turn fractions into decimals, how to round honestly, and one trap that catches every programmer: 0.1 + 0.2 isn't exactly 0.3 on a computer.

  • Read decimals as place value: tenths, hundredths, thousandths
  • Turn a fraction into a decimal by dividing, and spot a repeating decimal
  • Round to decimal places and to significant figures, by hand and with round() and :.2f
  • Compare decimals safely in Python, and scale pixel values to between 0 and 1
Quick check
Have a guess before you start. Which is bigger, 0.5 or 0.45?

The math: place value past the point

Purpose. Whole numbers stop at the ones place. Decimals keep going to the right, into places smaller than one, so you can write any part of a whole in the same digit system.

Each place to the right of the point is worth a tenth of the place before it:

ones.tenthshundredthsthousandths
0.375

So 0.375 means 3 tenths, 7 hundredths and 5 thousandths: 375 thousandths, or 375/1000.

Zooming into the number line helps. Between 0 and 1 there are ten tenths. Between 0.3 and 0.4 there are ten hundredths. Each digit you add zooms in ten times farther.

To compare decimals, line up the points and compare place by place from the left, filling empty places with zeros: 0.5 is 0.50, so it beats 0.45.

Fraction to decimal: divide the top by the bottom. Watch 3/8 become a decimal, one place at a time. The number line in the picture does the zooming for you: each digit lights the gap 3/8 falls in, and the next digit zooms into that gap, ten times closer.