VBScript Round 函數

定義和用法

Round 函數可對數字進行四舍五入。

語法

Round(expression[,numdecimalplaces])
參數 描述
expression 必需的。需要被四舍五入的表達式。
numdecimalplaces 可選的。規定對小數點右邊的多少位進行四舍五入。默認是 0。

實例

例子 1

dim x
x=24.13278
document.write(Round(x))

輸出:

24

例子 2

dim x
x=24.13278
document.write(Round(x,2))

輸出:

24.13