Rounds the numeric-expression to the specified integer-expression number of places after the decimal point.
Parameter |
Description |
---|---|
numeric-expression |
The number, passed to the function, to be rounded. |
integer-expression |
A positive integer specifies the number of significant digits to the right of the decimal point at which to round. A negative expression specifies the number of significant digits to the left of the decimal point at which to round. |
NUMERIC
When ROUND_TO_EVEN database option is set ON, the ROUND function rounds data from a SAP Sybase IQ table half to the nearest even number to the integer-expression, matching the behavior of SQL Anywhere table data. When the option is set to OFF, the ROUND function rounds SAP Sybase IQ data half away from zero.
The following statement returns the value 123.200:
SELECT ROUND( 123.234, 1 ) FROM iq_dummy
Additional results of the ROUND function are shown in the following table:
Value |
ROUND (Value) |
---|---|
123.4567 |
round (a.n,4) |
123.4570 |
round (a.n,3) |
123.4600 |
round (a.n,2) |
123.5000 |
round (a.n,1) |
123.0000 |
round (a.n, 0) |
120.0000 |
round (a.n,-1) |
100.0000 |
round (a.n,-2) |
0.0000 |
round(a.n,-3) |
In the following examples, the ROUND_TO_EVEN settings affects the value returned.
ROUND (Value) | ROUND_TO_EVEN ON | ROUND_TO_EVEN_OFF | Note |
---|---|---|---|
ROUND (convert (double, 123.45001), 1) | 123.5 | 123.5 | 0.05001 is more than half of 0.1 |
ROUND (convert (double, 123.45000), 1) | 123.4 | 123.5 | 0.0500 is half of 0.1 |