Arr
ar2
is a function that rounds a number to a specified increment. The method used is the method known as half away from zero.
arr(NUMEXPR1, NUMEXPR2)
NUMEXPR1
is a numeric expression that represents the number to be rounded.NUMEXPR2
is a numeric expression that represents the rounding increment. # Rounding to an integer valueRESULT = arr((11/7),1)# Rounding to one decimalRESULT = arr((11/7),0.1)# Swiss VAT computation (rounded to 5 centimes)AMT_TAXINCLUDED = arr( AMT_BASE * (1+TAX_RATE/100), 0.05 )# No rounding is done herePI_MAX_PREC=arr(pi,0)# Rounding to the integer for a negative valueROUNDED = arr(-40.5,1) : # ROUNDED is equal to -41
If Y is not equal to 0, arr
(X,Y) returns a rounded value that can be also calculated by:
* sgn(X)int(abs(X)/Y+0.5)/Y
* arr
(X/Y,1)*Y
If Y is equal to 0, arr
(X) returns X.
The type ID of the result is Decimal.
Error | Description |
---|---|
10 | The type of argument is not numeric. |