%ROUND

Round a value to the nearest whole number

WSupported on Windows
USupported on Unix
VSupported on OpenVMS
NSupported in Synergy .NET
whole_num = %ROUND(expression)

Return value

whole_num

The nearest whole-number value of a numeric expression. The result has the same numeric data type as expression. (n)

Arguments

expression

The numeric expression to round. (n)

Discussion

%ROUND rounds a numeric expression to the nearest whole number.

%ROUND follows normal rounding rules: fractional values less than .5 are rounded down, while fractional values of .5 and above are always rounded up. The fractional precision in the result is the same as the fractional precision in expression, and it is filled with zeros.

The difference between %RND and %ROUND is that with implied-decimal arguments, %RND returns a result with no fractional precision, and %ROUND returns a result with the same fractional precision as expression.

Examples

The following example returns a value of 35.00.

%round(34.56)