使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
math.sqrt
math.sqrt(number)
说明
返回给定数字的平方根。如果数字为负数,则返回 0。
形参数据类型
INT|FLOAT
返回类型
FLOAT
代码示例
示例 1
此示例返回 int 实参的平方根。
math.sqrt(3) = 1.732051
示例 2
此示例返回负整数实参的平方根。
math.sqrt(-3) = 0.000000
示例 3
此示例返回零实参的平方根。
math.sqrt(0) = 0.000000
示例 4
此示例返回浮点实参的平方根。
math.sqrt(9.223372) = 3.037000
示例 5
此示例返回负浮点实参的平方根。
math.sqrt(0-1.200000) = 0.000000
如未另行说明,那么本页面中的内容已根据知识共享署名 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.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"]]