%RND

Round a value to the nearest whole number

WSupported on Windows
USupported on Unix
VSupported on OpenVMS
NSupported in Synergy .NET
whole_num = %RND(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

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

%RND follows normal rounding rules: fractional values less than .5 are rounded down, while fractional values of .5 and above are always rounded up. The result does not contain any fractional precision.

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.

%rnd(34.56)