Stay organized with collections
Save and categorize content based on your preferences.
math.round
math.round(numericExpression, decimalPlaces)
Description
Returns a value rounded to the nearest integer or to the specified number of decimal places.
Param data types
NUMBER
Return type
NUMBER
Code samples
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
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-07-14 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-07-14 UTC."],[[["\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"]]