VBScript Round 函數(shù)
定義和用法
Round 函數(shù)可對(duì)數(shù)字進(jìn)行四舍五入。
語(yǔ)法
Round(expression[,numdecimalplaces])
參數(shù) | 描述 |
---|---|
expression | 必需的。需要被四舍五入的表達(dá)式。 |
numdecimalplaces | 可選的。規(guī)定對(duì)小數(shù)點(diǎn)右邊的多少位進(jìn)行四舍五入。默認(rèn)是 0。 |
實(shí)例
例子 1
dim x x=24.13278 document.write(Round(x))
輸出:
24
例子 2
dim x x=24.13278 document.write(Round(x,2))
輸出:
24.13