Stay organized with collections
Save and categorize content based on your preferences.
math.sqrt
math.sqrt(number)
Description
Returns the square root of the given number. Returns 0 in case of negative numbers.
Param data types
INT|FLOAT
Return type
FLOAT
Code samples
Example 1
This example returns the square root of an int argument.
math.sqrt(3) = 1.732051
Example 2
This example returns the square root of a negative int argument.
math.sqrt(-3) = 0.000000
Example 3
This example returns the square root of zero argument.
math.sqrt(0) = 0.000000
Example 4
This example returns the square root of a float argument.
math.sqrt(9.223372) = 3.037000
Example 5
This example returns the square root of a negative float argument.
math.sqrt(0-1.200000) = 0.000000
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.sqrt\u003c/code\u003e calculates the square root of a given number, supporting both \u003ccode\u003eINT\u003c/code\u003e and \u003ccode\u003eFLOAT\u003c/code\u003e data types.\u003c/p\u003e\n"],["\u003cp\u003eThe function returns a \u003ccode\u003eFLOAT\u003c/code\u003e value representing the square root.\u003c/p\u003e\n"],["\u003cp\u003eIf a negative number is provided as input, \u003ccode\u003emath.sqrt\u003c/code\u003e will return 0.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003emath.sqrt\u003c/code\u003e function is supported in \u003ca href=\"/chronicle/docs/detection/default-rules\"\u003eRules\u003c/a\u003e and \u003ca href=\"/chronicle/docs/investigation/udm-search\"\u003eSearch\u003c/a\u003e.\u003c/p\u003e\n"]]],[],null,["### math.sqrt\n\nSupported in: \n[Rules](/chronicle/docs/detection/default-rules) [Search](/chronicle/docs/investigation/udm-search) \n\n math.sqrt(number)\n\n#### Description\n\nReturns the square root of the given number. Returns 0 in case of negative numbers.\n\n#### Param data types\n\n`INT|FLOAT`\n\n#### Return type\n\n`FLOAT`\n\n#### Code samples\n\n##### Example 1\n\nThis example returns the square root of an int argument. \n\n math.sqrt(3) = 1.732051\n\n##### Example 2\n\nThis example returns the square root of a negative int argument. \n\n math.sqrt(-3) = 0.000000\n\n##### Example 3\n\nThis example returns the square root of zero argument. \n\n math.sqrt(0) = 0.000000\n\n##### Example 4\n\nThis example returns the square root of a float argument. \n\n math.sqrt(9.223372) = 3.037000\n\n##### Example 5\n\nThis example returns the square root of a negative float argument. \n\n math.sqrt(0-1.200000) = 0.000000"]]