Returns a number rounded to a specified number of decimal places.
For the purposes of the PROMOTIC system, it is more usefull to use the method: Pm.Round.
Double Round(Double expression, [Integer numdecimalplaces])
n = Round(expression[, numdecimalplaces])
|expression||(Double) Numeric expression being rounded|
|numdecimalplaces||[optional] (Integer) Number indicating how many places to the right of the decimal are included in the rounding. If not set, then integers are returned.|
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).
VBScriptSelect and copy to clipboard
Dim pi, nVar
pi = 3.14159
nVar = Round(pi, 2) 'nVar contains 3.14