Skip to main content

ASIN

The ASIN function is used to calculate the arcsine (inverse sine) of a number. It takes a single numeric argument, which should be a float value in the range of -1 to 1, and returns the arcsine of that number in radians.

Syntax

ASIN(value)
  • value: A numeric expression for which the arcsine is to be calculated. The value should be in the range of -1 to 1.

Examples

Let's consider a table named SingleItem with the following schema:

CREATE TABLE SingleItem (id INTEGER);

Insert a row into the SingleItem table:

INSERT INTO SingleItem VALUES (0);

Example 1: Using ASIN with float values

SELECT ASIN(0.5) AS asin1, ASIN(1) AS asin2 FROM SingleItem;

Result:

     asin1      |     asin2
----------------+---------------
0.5235987755983 | 1.5707963267949

Example 2: Using ASIN with NULL values

SELECT ASIN(NULL) AS asin FROM SingleItem;

Result:

  asin
-------
(null)

Errors

The ASIN function requires a numeric value in the range of -1 to 1 as its argument. Using non-numeric values or more than one argument will result in an error.

Example 3: Using ASIN with non-numeric values

SELECT ASIN('string') AS asin FROM SingleItem;

Error: Function requires a numeric value.

Example 4: Using ASIN with multiple arguments

SELECT ASIN(1.0, 2.0) AS sin FROM SingleItem;

Error: Function expects 1 argument, but 2 were provided.