The ROUND
function rounds a value. The number of decimal places to round to is specified by a positive value in the num_digits
parameter. A negative value for the num_digits
will round the integer portion of the value left of the decimal point, e.g. to the nearest 10 (for -1) or to the nearest 1000 (for -3).
Here's a table showing how round may be used.
Starting with | ROUND(b,2) | ROUND(b,1) | ROUND(b) | ROUND(b,-1) |
---|---|---|---|---|
23.10651375 | 23.11 | 23.1 | 23 | 20 |
19.16818924 | 19.17 | 19.2 | 19 | 20 |
3.92748883 | 3.93 | 3.9 | 4 | 0 |
31.38208409 | 31.38 | 31.4 | 31 | 30 |
38.34235561 | 38.34 | 38.3 | 38 | 40 |
7.682632495 | 7.68 | 7.7 | 8 | 10 |
35.39315416 | 35.39 | 35.4 | 35 | 40 |
20.47004449 | 20.47 | 20.5 | 20 | 20 |
20.49775276 | 20.5 | 20.5 | 20 | 20 |
2.288822497 | 2.29 | 2.3 | 2 | 0 |
Additional similar functions are also available to control the direction of rounding:
ROUNDUP
- Always rounds a number up, away from zero.ROUNDDOWN
- Always rounds a number down, towards zero.