透過集合功能整理內容
你可以依據偏好儲存及分類內容。
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
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-29 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-07-29 (世界標準時間)。"],[[["\u003cp\u003e\u003ccode\u003emath.round\u003c/code\u003e function rounds a numeric value to the nearest integer or a specified number of decimal places.\u003c/p\u003e\n"],["\u003cp\u003eThe function supports \u003ccode\u003eNUMBER\u003c/code\u003e as the input data type and returns a \u003ccode\u003eNUMBER\u003c/code\u003e type value.\u003c/p\u003e\n"],["\u003cp\u003eIf no decimal places are specified, the function rounds to the nearest whole number.\u003c/p\u003e\n"],["\u003cp\u003eNegative values can be used and will be rounded accordingly to the nearest negative whole number or to the specified negative decimal place.\u003c/p\u003e\n"],["\u003cp\u003eThe function is available within the context of \u003ccode\u003eSearch\u003c/code\u003e as described in the documentation.\u003c/p\u003e\n"]]],[],null,["### math.round\n\nSupported in: \n[Search](/chronicle/docs/investigation/udm-search) \n\n math.round(numericExpression, decimalPlaces)\n\n#### Description\n\nReturns a value rounded to the nearest integer or to the specified number of decimal places.\n\n#### Param data types\n\n`NUMBER`\n\n#### Return type\n\n`NUMBER`\n\n#### Code samples\n\n math.round(10.7) // returns 11\n math.round(1.2567, 2) // returns 1.25\n math.round(0-10.7) // returns -11\n math.round(0-1.2) // returns -1\n math.round(4) // returns 4, math.round(integer) returns the integer"]]