How Asind() Works in PostgreSQL

In PostgreSQL, asind() is a mathematical function that returns the angle, in degrees, whose sine is the specified expression.

In other words, it returns the arcsine of its argument.

The arcsine is typically used to find the measure of an angle when two sides of a right triangle are known.

The arcsine is the inverse of the sine function. To return the sine in Postgres, use sind() to specify the angle in degrees, or sin() to specify it in radians.

Syntax

The syntax goes like this:

asind(x)

Where x is a double precision value.

Example

Here’s an example to demonstrate how it works.

SELECT asind(1);

Result:

90.0

Fractions

The argument can contain a fractional component.

SELECT asind(0.1234);

Result:

7.088367177779527

Negative Argument

The argument can also be negative.

SELECT asind(-0.1234);

Result:

-7.088367177779527

Expressions

The argument can include expressions.

SELECT asind(.5 * 1.45);

Result:

46.46884783262754

Out of Range Error?

Only a value ranging from -1.00 to 1.00 is valid. Values outside this range return an “out of range” error.

SELECT asind(1.01);

Result:

ERROR: input is out of range

And here it is with a negative value.

SELECT asind(-1.01);

Result:

ERROR: input is out of range

Return the Angle in Radians

As mentioned, asind() returns its result in degrees. To get it in radians, use the asin() function.

The asin() function works exactly the same as asind(), except that its result is specified in radians instead of degrees.