使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
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
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):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"]],["最后更新时间 (UTC):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"]]