Skip to content
Varlig Guide
Varlig home

Rounding

This page covers rounding inside a calculation: to a number of decimal places or significant figures, to a whole number, and to a step such as the nearest £0.50 or 15 minutes. Reach for it when you need a tidy figure to use further down a note, such as how many tables to hire or what each person should pay.

There are a few different operations, and they are easy to mix up:

  • Decimal places keep a certain number of digits after the point: 3.14159 to 2 dp is 3.14.
  • Significant figures keep a certain number of digits from the first one that isn’t zero: 12,345 to 3 sf is 12,300.
  • Steps round to a multiple of something: 17 to the nearest 5 is 15.

Rounding in a calculation changes the value that later lines use. If you only want an answer to look tidier, try the answer formatting options in the line’s context menu instead.

Decimal places

Add to N dp to a calculation to round its answer:

calc
100 / 7 to 2 dp gives 14.29
pi to 5 dp gives 3.14159
2 kg / 3 to 2 dp gives 0.67 kg
14 kg / 3 to 1 dp gives 4.7 kg

These forms all mean the same thing:

Form Example Result
to N dp 1.23456 to 2 dp 1.23
to N decimal places 1.23456 to 2 decimal places 1.23
to N digits 1.23456 to 2 digits 1.23
rounded to N dp 1.23456 rounded to 2 dp 1.23
rounded to N decimal places 1.23456 rounded to 2 decimal places 1.23
-> N dp 1.23456 -> 2 dp 1.23

decimal place works in the singular too, as in 17.456 to 1 decimal place.

to 0 dp rounds to a whole number. Halves round away from zero, so 2.5 to 0 dp is 3 and -2.25 to 1 dp is -2.3. Units stay attached to the rounded value.

Rounding conversions and function results

Put to N dp straight after a conversion or a function call. A conversion rounds in the unit you converted to, whether you wrote in or to:

calc
42.195 km to miles to 1 dp gives 26.2 mi
sqrt(2) to 4 dp gives 1.4142
average(1, 2, 4) to 2 dp gives 2.33

For an answer in two units, such as feet and inches, the decimal places apply to the smaller unit: 170 cm in feet and inches to 0 dp is 5 feet 7 inches. See Two-unit answers.

Rounding money

Amounts of money are shown with two decimal places, but the full value is kept for later lines. That usually works in your favour: a third of £100 shows as £33.33, yet three thirds add back up to exactly £100.

calc
£100 / 3 gives £33.33
£100 / 3 * 3 gives £100.00

Round explicitly when the rounded figure is what really gets paid. Each person below pays £33.33, so the three payments come to £99.99:

calc
share = £100 / 3 to 2 dp gives £33.33
share * 3 gives £99.99

Significant figures

Scientists, engineers and anyone quoting a rough figure often round to significant figures instead. Write to N sf, to N significant figures or to N sig figs:

calc
12345.678 to 3 sf gives 12,300
0.0012345 to 2 sf gives 0.0012
12345.678 to 3 significant figures gives 12,300
round 987.65 to 2 sig figs gives 990

rounded to N sf and round … to N sf work too. Halves round away from zero, and units stay attached, so sqrt(2 * 9.81 m/s² * 45 m) to 3 sf is 29.7 m/s.

Nearest whole number

rounded after a value, or round(…) around it, gives the nearest whole number:

calc
4.5 rounded gives 5
4.4 rounded gives 4
round(£12.50) gives £13.00

Rounding up and down

To force the direction, add up or down. You can put the phrase after the value or in front of it:

calc
12.3 rounded up gives 13
12.7 rounded down gives 12
round up 12.3 gives 13
round 12.7 down gives 12

Rounding up is what you want when a part-filled unit still counts as a whole one:

calc
guests = 23
guests / 6 rounded up gives 4
round up guests / 6 gives 4
round down guests / 6 gives 3

Twenty-three guests at tables of six need four tables, and three tables fill up completely. A leading round up or round down rounds the whole calculation that follows it, so you can put the phrase wherever it reads best.

Negative numbers

With negative numbers, up means towards positive infinity and down towards negative infinity, the same way the numbers run on a number line. Plain rounding still rounds halves away from zero:

calc
-2.5 rounded gives -3
-2.5 rounded up gives -2
-2.5 rounded down gives -3

Function forms

Function Rounds Example Result
round(x) To the nearest, halves away from zero round(-2.5) -3
floor(x) Down, towards negative infinity floor(-2.5) -3
ceil(x) Up, towards positive infinity ceil(-2.5) -2
trunc(x) Towards zero, dropping the decimal part trunc(-2.5) -2
int(x) Same as trunc int(12.7) 12

floor and ceil work with money and units (ceil(£12.01) is £13.00). trunc and int only take plain numbers.

Rounding to a step

Add to nearest and a step to round to a multiple of that step. rounded up to nearest and rounded down to nearest force the direction:

calc
2,340 rounded to nearest 100 gives 2,300
2.3 to nearest 0.25 gives 2.25
£1,237 rounded up to nearest £100 gives £1,300.00
£4.38 rounded to nearest 5p gives £4.40
£4.386 to nearest penny gives £4.39
$4.38 rounded up to the nearest dollar gives $5.00
$2.37 rounded to nearest 50c gives $2.50
47 min rounded up to nearest 15 min gives 60 min

The last line is how you might round time on a timesheet to the next quarter of an hour. Write a money step in coins, such as nearest 5p, nearest 10p or nearest 5 cents, or as an amount, such as nearest £0.05. Name a coin or currency without a number to round to one of it: nearest penny, nearest cent, nearest pound, nearest dollar or nearest euro. Every form also reads to the nearest, as in 17 to the nearest 5. A step in another currency, such as $4.38 to nearest pound, or a length, weight or time as the step for money, shows an error.

The same phrase works in front of the value, with the direction in either place:

calc
round £1,237 to nearest £50 gives £1,250.00
round up £1,237 to nearest £100 gives £1,300.00
round £1,237 up to nearest £100 gives £1,300.00

Steps with units

A step may use a different unit from the value, as long as they measure the same thing. The step is converted first, and the answer keeps the value’s unit:

calc
1.3 kg rounded up to nearest 500 g gives 1.5 kg
3.7 km to nearest 500 m gives 3.5 km
round 1.3 kg to nearest 500 m gives Error: incompatible units

The two-argument round

round(x, step) is the function form of rounding to a step:

calc
round(47 min, 15 min) gives 45 min
round(£12.345, £0.01) gives £12.35
round(5.567, 0.01) gives 5.57

Rounding hours and minutes

A duration in hours and minutes rounds as a whole. Plain rounding goes to the nearest hour, and a step such as 15 minutes suits a timesheet:

calc
worked = 1 hour 52 min
round(worked) gives 2 hours
worked to nearest 15 min gives 1 hour 45 min
worked rounded up to nearest 15 min gives 2 hours

Decimal places apply to the smallest unit, as they do for feet and inches, so worked to 0 dp leaves 1 hour 52 min as it is. To round to the hour, use round or a step.

Putting it together

Planning food and tables for a garden party:

calc
# Garden party
guests = 42
per table = 8
tables = guests / per table rounded up gives 6
pizzas = guests * 3 / 8 rounded up gives 16
pizza price = £11.50
pizza bill = pizzas * pizza price gives £184.00
each = pizza bill / guests rounded up to nearest £0.50 gives £4.50
each * guests gives £189.00

Tables and pizzas are rounded up because a part table or part pizza still has to be a whole one. Allowing three slices each from eight-slice pizzas gives 15.75, so you order 16. Each guest’s share is rounded up to a friendly £4.50, and the last line shows that this covers the £184 bill with a little to spare.