acos()
The acos() function returns the arccosine (inverse cosine) of the input value in radians.
Syntax
acos(NUM_EXPR)
Parameters
NUM_EXPR- A numeric expression whose arccosine is to be computed. The value must be between -1 and 1 (inclusive).
Description
The acos() function applies Math.acos() to the input and returns the result as a 64-bit double. If the input is a Number type, it is internally converted using doubleValue() before processing.
Returns null if the input is null or not a number. Returns NaN if the input is less than -1 or greater than 1.
Error codes
N/A
Usage examples
-
Calculate the angle (90 degrees) whose cosine is 0.
json "{'val': 0}" | eval result = acos(val) | # result: 1.5707963267948966 -
Calculate the angle (0 degrees) whose cosine is 1.
json "{'val': 1}" | eval result = acos(val) | # result: 0.0 -
NULL input
json "{'val': null}" | eval result = acos(val) | # result: null
Compatibility
The acos() function is available since before Sonar 4.0.