VBScript RoundFunction


VBScript 参考手册Complete VBScript Reference

The Round function rounds a number.

Syntax

Round(expression[,numdecimalplaces])

Parameters Description
expression Required. A numeric expression to be rounded.
numdecimalplaces Optional. Specifies how many places to the right of the decimal point to round to. Default is 0.

Examples

Example 1

<script type="text/vbscript">

document.write(Round(24.13278) & "<br />")
document.write(Round(24.75122))

</script>

The output of the above example is:

24
25

Try it Yourself »

Example 2

How to round a number to 2 decimal places:

<script type="text/vbscript">

document.write(Round(24.13278,2))

</script>

The output of the above example is:

24.13

Try it Yourself »

VBScript 参考手册Complete VBScript Reference Other Extensions