Skip to main content

ROUND

ROUND(realvalue[, decimals ] )

realvalueThe floating-point value to round.
decimalsOptional. An integer specifying the number of decimal places to round to. If omitted, the default is zero (integer result).
Return:ROUND returns a single numeric value.

The ROUND function returns the rounded realvalue by using standard arithmetic rounding (decimal portions less than .5 round down and decimal portions greater than or equal to .5 round up).

Example:

SomeRealValue1 := 3.14159;
INTEGER4 MyVal1 := ROUND(SomeRealValue1);   // MyVal1 is 3
REAL     MyVal2 := ROUND(SomeRealValue1,2); // MyVal2 is 3.14

SomeRealValue2 := 3.5;
INTEGER4 MyVal3 := ROUND(SomeRealValue2); // MyVal is 4

SomeRealValue3 := -1.3;
INTEGER4 MyVal4 := ROUND(SomeRealValue3); // MyVal is -1

SomeRealValue4 := -1.8;
INTEGER4 MyVal5 := ROUND(SomeRealValue4); // MyVal is -2

See Also: ROUNDUP, TRUNCATE