PostgreSQL Tutorial PostgreSQL Advanced PostgreSQL Database Account Management PostgreSQL References
PostgreSQL Tutorial PostgreSQL Advanced PostgreSQL Database Account Management PostgreSQL References

PostgreSQL ASIN() Function



The PostgreSQL ASIN() function returns arc sine of a value. The returned value will be in the range -𝜋/2 through 𝜋/2. The other variant of this function is ASIND() which returns the result in degrees.

If the argument is not within the range of -1 to 1, then this function returns an error.

Note: ASIN() is the inverse of SIN().

Syntax

/* returns result in radians */
ASIN(x)

/* returns result in degrees */
ASIND(x)

Parameters

x Required. Specify the value.

Return Value

Returns the arc sine of the value.

Example 1:

The example below shows the usage of ASIN() function.

SELECT ASIN(0.2);
Result: 0.2013579207903308

SELECT ASIN(0.8);
Result: 0.9272952180016123

SELECT ASIN(1);
Result: 1.5707963267948966

SELECT ASIN(-1);
Result: -1.5707963267948966

SELECT ASIN(0);
Result: 0

SELECT ASIN(-0.2);
Result: -0.2013579207903308

SELECT ASIND(-0.2);
Result: -11.536959032815487

SELECT ASIND(-1);
Result: -90

Example 2:

Consider a database table called Sample with the following records:

Datax
Data 1-1
Data 2-0.5
Data 30
Data 40.5
Data 51

The statement given below can be used to calculate the arc sine of records of column x.

SELECT *, ASIN(x) AS ASIN_Value FROM Sample;

This will produce the result as shown below:

DataxASIN_Value
Data 1-1-1.5707963267948966
Data 2-0.5-0.5235987755982989
Data 300
Data 40.50.5235987755982989
Data 511.5707963267948966

❮ PostgreSQL Functions