In PostgreSQL, sind()
is a mathematical function that returns the trigonometric sine of the specified angle, as measured in degrees.
You specify the angle by providing an argument to the function when calling it.
In trigonometry, sine is the function that is equal to the ratio of the side opposite a given angle (in a right-angled triangle) to the hypotenuse.
Syntax
The syntax goes like this:
sind(x)
Where x
is a double precision value that represents the angle (in degrees) for which you want the sine returned.
Example
Here’s an example to demonstrate how it works.
SELECT sind(45);
Result:
0.7071067811865475
Fractions
The angle can contain a fractional component.
SELECT sind(45.6789);
Result:
0.7154354836424379
Negative Angles
The angle can be negative.
SELECT sind(-35);
Result:
-0.573576436351046
Expressions
The argument can include expressions.
SELECT sind(3 * 5);
Result:
0.2588190451025208
Specify the Angle in Radians
As mentioned, the angle you provide to sind()
is specified in degrees. To specify it in radians, use the sin()
function.
The sin()
function works exactly the same as sind()
, except that its argument is specified in radians instead of degrees.