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 typeDOUBLE
See<sql-expression> Expression
FedSQL Expressions

rounding-unit

specifies any valid expression that evaluates to a numeric expression and that specifies the rounding unit.

Default1
RequirementOnly positive values are valid.
Data typeDOUBLE
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:

Function Examples

Statement

Results

select put(roundz(223.456, 1), 9.5); 
223.00000
select put(roundz(223.456, .01), 9.5);
223.46000
select put(roundz(223.456, 100), 9.5);
200.00000
select put(roundz(223.456, .3), 9.5);
223.50000

See Also

Last updated: February 16, 2026