ROUND function

Purpose

Round a numeric value to a specified number of decimal places.

Syntax

x = ROUND(numeric_expression, n)

Remarks

n is an integer-class expression specifying the number of decimal places required in the result.  ROUND is especially useful in cases where you have a variable in Single, Double, or Extended-precision, and you want to put it into a Currency variable or display it, rounded to a specific number of decimal places.

Rounding is done according to the "banker's rounding" principle: if the fractional digit being rounded off is exactly five, with no trailing digits, the number is rounded to the nearest even number.  This provides better results, on average, than the simple "round up at five" approach.

A% = ROUND(0.5, 0)             ' 0

A% = ROUND(1.5, 0)             ' 2

A% = ROUND(2.5, 0)             ' 2

A% = ROUND(2.51, 0)            ' 3

See also

CEIL, FIX, FORMAT$, INT, USING$