MySQL ACOS() Function
The ACOS()
function in MySQL calculates the arccosine (inverse cosine) of a number. The arccosine of a number is the angle whose cosine is that number. The result is an angle expressed in radians.
ACOS(): Definition and Usage
ACOS()
is a mathematical function primarily used in trigonometry and related fields. It's the inverse of the COS()
function. Remember that the input number (the value whose arccosine you're finding) must be between -1 and 1 (inclusive); otherwise, the function will return NULL
.
Syntax
Syntax
ACOS(number)
Parameter Values
Parameter | Description |
---|---|
number |
The numeric value for which you want to compute the arccosine (must be between -1 and 1). This is required. |
Examples
Calculating the Arccosine of a Positive Number
This example calculates the arccosine of 0.25.
Syntax
SELECT ACOS(0.25);
Output
1.3181160716528 (Result in radians)
Calculating the Arccosine of a Negative Number
This example demonstrates calculating the arccosine of -0.8.
Syntax
SELECT ACOS(-0.8);
Output
2.49809154478799 (Result in radians)