The ROUND function returns a numeric expression rounded to a specified number of decimal places. If the value specified by n is positive and longer than the digits after the decimal point, 0 is added after the fraction digits. If the value specified by n is negative and larger than or equal to the digits before the decimal point, 0.00 is returned.
$ROUND(numeric_expression [, n])
Required. Any expression that returns a numeric expression.
Optional. n is an integer indicating the number of digits to the right of the decimal. The default is 0.
> select latitude, round(latitude) from countries;
LATITUDE ROUND(COUNTRIES.LATITUDE)
-------------------------------- --------------------------------
42.500000 43.000000
24.000000 24.000000
33.000000 33.000000
17.049999 17.000000
18.209999 18.000000
41.000000 41.000000
40.000000 40.000000
Note that floating point values cannot represent ever value, and the values shown below are as close as floating point values can represent.
> select latitude, round(latitude, 1) from countries;
LATITUDE ROUND(COUNTRIES.LATITUDE,1)
-------------------------------- --------------------------------
42.500000 42.500000
24.000000 24.000000
33.000000 33.000000
17.049999 17.000000
18.209999 18.200001
41.000000 41.000000
40.000000 40.000000
See also: