acos
1. ACOS Function
=======acos
1. ACOS Function
>>>>>>> 9d19b1c8cb744c8e86d5c15b74d8b5f719ad62beThe ACOS function in H2 database is used to calculate the arccosine (inverse cosine) of a given value.
2. Syntax
The syntax for the ACOS function in H2 database is as follows:
ACOS(value)
Arguments
value
: The value for which the arccosine needs to be calculated. It should be a numeric value between -1 and 1.
Return
- The ACOS function returns the arccosine of the given value in radians.
3. Notes
- The ACOS function in H2 database returns the angle in radians. If you need the result in degrees, you can convert it using the
DEGREES
function. - If the input value is not a number or exceeds the valid range, the ACOS function will return
NULL
. - Take care to provide valid input values within the range of -1 to 1 to get accurate results.
4. Examples
Here are a few examples demonstrating the usage of the ACOS function in H2 database:
Example 1 - Calculating the arccosine of 0.5:
SELECT ACOS(0.5) AS arccosine;
Output:
arccosine
---------
1.0471975511965979
Example 2 - Calculating the arccosine of values stored in a column:
CREATE TABLE values (
id INT PRIMARY KEY,
val DOUBLE
);
INSERT INTO values VALUES (1, 0.5), (2, 0.8), (3, -0.3);
SELECT id, val, ACOS(val) AS arccosine
FROM values;
Output:
id | val | arccosine
---+-----+---------------------
1 | 0.5 | 1.0471975511965979
2 | 0.8 | 0.643501109 rad
3 | -0.3| 1.88219118 rad