ROUNDZ Function
Rounds the first argument to the nearest multiple of the second argument, using zero fuzzing.
| Categories: | CAS |
|---|---|
| Truncation | |
| Returned data type: | DOUBLE |
Syntax
Arguments
expression
specifies any valid expression that evaluates to a numeric value.
| Data type | DOUBLE |
|---|---|
| See | <sql-expression> Expression |
| FedSQL Expressions |
rounding-unit
specifies any valid expression that evaluates to a numeric expression and that specifies the rounding unit.
| Default | 1 |
|---|---|
| Requirement | Only positive values are valid. |
| Data type | DOUBLE |
| See | <sql-expression> Expression |
| FedSQL Expressions |
Details
The ROUNDZ function rounds the first argument to the nearest multiple of the second argument.
Comparisons
The ROUNDZ function is the same as the ROUND function with these exceptions:
- ROUNDZ returns an even multiple when the first argument is exactly halfway between the two nearest multiples of the second argument. ROUND returns the multiple with the larger absolute value when the first argument is approximately halfway between the two nearest multiples.
- When the rounding unit is less than one and not the reciprocal of an integer, the result that is returned by ROUNDZ might not agree exactly with the result from decimal arithmetic. ROUNDZ does not fuzz the result. ROUND performs extra computations, called fuzzing, to try to make the result agree with decimal arithmetic.
Example: Sample Output from the ROUNDZ Function
The following statements illustrate the ROUNDZ function:
|
Statement |
Results |
|---|---|
|
|
|
|
|
|
|
|
See Also
-
Functions: