How ASIN() Works in SQLite

The ASIN() function in SQLite calculates the arc sine (inverse sine) of a given numeric value. The result is the angle in radians whose sine is the specified number.

Syntax

ASIN(X)

Where X is the numeric value for which you want to calculate the arc sine. This value must be between -1 and 1, inclusive, because these are the only values for which a real sine value exists.

The result will be an angle in radians between -π/2 and π/2 (approximately -1.5708 and 1.5708).

Example 1

Here’s a quick example to demonstrate how it works:

SELECT ASIN(0.2);

Output:

0.201357920790331

Example 2

Suppose we have a table angles with a column sin_value that contains sine values. We want to find the corresponding angle in radians for these values.

CREATE TABLE angles (sin_value REAL);

INSERT INTO angles (sin_value) VALUES (1), (0.5), (0), (-0.5), (-1);

Now, we can use ACOSH() to calculate the inverse hyperbolic cosine for each value:

SELECT sin_value, ASIN(sin_value) AS angle_in_radians
FROM angles;

Output:

sin_value  angle_in_radians  
--------- ------------------
1.0 1.5707963267949
0.5 0.523598775598299
0.0 0.0
-0.5 -0.523598775598299
-1.0 -1.5707963267949

In this example:

  • When sin_value is 1, the angle is Ï€/2 radians (approximately 1.5708), as the sine of Ï€/2 is 1.
  • When sin_value is 0.5, the angle is approximately 0.523598775598299 radians.
  • When sin_value is 0, the angle is 0 radians because the sine of 0 radians is 0.
  • Similarly, -1 corresponds to -Ï€/2 radians, or approximately -1.5707963267949.

The ASIN() function is useful in trigonometric calculations, especially when converting a sine value back to an angle.