math.round

支援的國家/地區:
math.round(numericExpression, decimalPlaces)

說明

傳回四捨五入至最接近整數或指定小數位數的值。

參數資料類型

NUMBER

傳回類型

NUMBER

程式碼範例

math.round(10.7) // returns 11
math.round(1.2567, 2) // returns 1.25
math.round(0-10.7) // returns -11
math.round(0-1.2) // returns -1
math.round(4) // returns 4, math.round(integer) returns the integer