Syntax: Round(Number, NumDecimalPlaces) Number The Number argument is the number you wish to round off. NumDecimalPlaces The optional NumDecimalPlaces argument specifies how many decimal places to round off to.
The Round function rounds off a floating-point number (decimal) to a specified number of decimal places.
There is one mandatory argument.
Examples
Code: <% =Round(1.123456789) %> Output: 1 Explanation: If the number of decimal places to round off to is not specified, the number is rounded off to an integer. Language(s): VBScript Code: <% =Round(9.87654321) %> Output: 10 Language(s): VBScript Code: <% =Round(-2.899999999) %> Output: -3 Explanation: Note that negative numbers are rounded down (more negative). Language(s): VBScript Code: <% =Round(4.50) %> <% =Round(3.5) %> <% =Round(2.5000) %> <% =Round(1.5) %> <% =Round(0.50000) %> <% =Round(-0.50) %> <% =Round(-1.5) %> <% =Round(-2.50000000) %> <% =Round(-3.5) %> <% =Round(-4.5) %> Output: 4 4 2 2 0 0 -2 -2 -4 -4 Explanation: Even numbers that are composed of the exact decimal .5, such as 2.5, 4.50, or 22.500000, are rounded down (towards the negative direction).
Negative, even numbers are rounded up (towards the postive direction).
Odd number that are composed of the exact decimal .5, such as 1.5, 3.50, or 21.500000, are rounded up (towards the positive direction).
Negative, odd numbers are rounded down (towards the negative direction). Language(s): VBScript Code: <% =Round(1.123456789, 6) %> Output: 1.123457 Language(s): VBScript Code: <% =Round(-2.899999999, 2) %> Output: -2.9
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.