MySQL - ASIN() Function



The ASIN() function in MySQL, is used to calculate the arc sine value of a number.

An arc sine of an angle is defined as the inverse of the sine function. A sine function in a right-angled triangle is defined as the ratio of an opposite side of the said angle to the hypotenuse. Therefore, the domain of the sine function will become the range of the arc sine function and vice-versa. Therefore, the domain for this arc sine function is [-1, 1].

This function accepts an integer number as an argument and returns the arc sin value for the given integer.

Syntax

Following is the syntax of MySQL ASIN() function −

ASIN(x)

Parameters

This function takes an integer value between 1 and -1 representing a sine as a parameter.

Return Value

This function returns the angle in radians of the given sine value.

Example

The following query uses the MySQL ASIN() function to calculate the arcsine (inverse sine) of the value 0.8 −

SELECT ASIN(0.8) As Result;

Output

The output for the query above is produced as given below −

Result
0.9272952180016123

Example

You can also pass negative value to this function as shown below −

SELECT ASIN(-0.5) As Result;

Output

This will produce the following result −

Result
-0.5235987755982989

Example

If the value passed is to this function is not in the range of -1 to 1 this function returns a NULL value −

SELECT ASIN(6) As Result;

Output

This will produce the following result −

Result
NULL

Example

The following query calculates the arcsine (inverse sine) of the value 0 −

SELECT ASIN(0) As Result;

Output

The output for the query above is produced as given below −

Result
0

Example

The sine value of the result (of asin function) will be equal to the given value −

SELECT ASIN(1) As Result;

This will produce the following result −

Result
1.5707963267948966
SELECT SIN(1.5707963267948966) As Result;

On executing the given program, the output is displayed as follows −

Result
1
Advertisements