Skip to main content

asin

1. ASIN Function

The ASIN function in H2 database is used to calculate the arcsine of a given value.

2. Syntax

The syntax for the ASIN function in H2 database is as follows:

ASIN(value)

Arguments

  • value: The value for which the arcsine needs to be calculated. It should be a numeric value within the range of -1 to 1.

Return

  • The ASIN function returns the arcsine of the given value in radians.

3. Notes

  • The ASIN function in H2 database returns the result in radians.
  • The input value must be between -1 and 1. If the value is outside this range, the ASIN function will return NULL.
  • Ensure that the datatype of the input value is compatible with the ASIN function to avoid errors.

4. Examples

Here are a few examples demonstrating the usage of the ASIN function in H2 database:

Example 1 - Calculating the arcsine of 0.5:

SELECT ASIN(0.5) AS arcsine;

Output:

arcsine
-------
0.5235987755982989

Example 2 - Calculating the arcsine of values stored in a column:

CREATE TABLE values (
id INT PRIMARY KEY,
val DOUBLE
);

INSERT INTO values VALUES (1, 0.25), (2, 0), (3, -0.8);

SELECT id, val, ASIN(val) AS arcsine
FROM values;

Output:

id |  val  |       arcsine
---+-------+-------------------
1 | 0.25 | 0.2526802551420796
2 | 0 | 0.0
3 | -0.8 | -0.9272952180016122
  • sin - Calculate sine
  • cos - Calculate cosine