Nearest integer, or value at given precision.
Return nearest integer or nearest decimal number at the given precision.
Syntax: @round(x[, n])
x: number
n: (optional) integer
Return: number
The decimal offset n may be interpreted as the precision to use when rounding the number.
• @round(x) returns the nearest integer to x. Numbers exactly midway between integers (e.g., 1.5 or 37.5) are rounded to next higher integer.
• @round(x, n) rounds to the nearest decimal number to x at the given precision:
.
If
n is not an integer, the integer floor
will be used.
Examples
= @round(-97.5)
returns -98.
= @round(@pi, 3)
returns 3.142.
Cross-references
See also
@ceil and
@floor.