ROUND

The ROUND function rounds the specified number up or down to the (optionally) specified number of decimal places.

Syntax

ROUND ( num, decimals )

num

A DOUBLE PRECISION number that is the numeric value you want rounded.

decimals

Optional. An integer value that specifies the number of decimal digits to which you want number rounded.

If you do not specify decimals, then num is rounded to an integer value.

If decimals is a negative number, then num is rounded to that number of digits to the left of the decimal point.

Examples

splice>VALUES ROUND(84.4);
1
----------
84


splice>VALUES ROUND(84.4, 1);
1
----------
84.4

1 row selected


splice>VALUES ROUND(84.4, 0);
1
----------
84.0

1 row selected


splice>VALUES ROUND(84.4, -1);
1
----------
80.0

1 row selected


splice>VALUES ROUND(844.4, -1);
1
----------
840.0

1 row selected


splice>VALUES ROUND(844.4, -2);
1
----------
800.0

1 row selected

Results

The data type of the result is a  DOUBLE PRECISION number.

  • If the specified number is NULL, the result of this function is NULL.
  • If the specified number is equal to a mathematical integer, the result of this function is the same as the specified number.
  • If the specified number is zero (0), the result of this function is zero.

See Also