Description:
Returns a number rounded to a specified number of decimal places.
In the PROMOTIC system it is better to use the Pm.Round method.
Syntax:
Double Round(Double expression, [Integer numdecimalplaces])
Parameters:
expression | (Double) Numeric expression being rounded |
numdecimalplaces | [optional] (Integer) Number specifies how many places to the right of the decimal are included in the rounding.
If not set, then integers are returned. |
---|
Note:
Be careful on rounding the number 5. The function doesn't round this number always up but on the statistical basis (i.e. that after rounding many numbers, we would get the most accurate result). The function solves this problem so that odd numbers (e.g. 1.15) are rounded up (to 1.2), while even numbers (e.g. 1.25) are rounded down (to 1.2).
Example:
VBScriptSelect and copy to clipboard
Dim pi, nVar
pi = 3.14159
nVar = Round(pi, 2)
' nVar contains 3.14