Using Trigonometric Functions

SQL Server provides trigonometric functions that return radians.

Functions returning radians

Use radians as input value

ACOS

TAN

COS

SIN

ATAN

ASIN

ATN2

 

COT

 

ACOS and COS

Both ACOS and COS are trigonometric functions. The ACOS function returns the angle, in radians, whose cosine is the specified float expression. The COS function returns the cosine of the specified angle, in radians, based on the float expression. For example, the following SELECT statement calculates the ACOS of -.997 and the COS for the value 1.134:

SELECT ACOS(-.997), COS(1.134);

Therefore, the angle that measures 3.06411360866591 radians has a cosine value of -.997, and the angle measuring 1.134 radians has a cosine value of 0.423038755545785.

The valid ranges for ACOS are from -1 through 1.

ASIN and SIN

Both ASIN and SIN are trigonometric functions that use a float expression. The ASIN function calculates the angle, measured in radians, whose sine is the specified float expression. The SIN function calculates the trigonometric sine value of the angle, measured in radians, as a float expression.

The following example calculates the ASIN of -.7582 and the SIN of 5. The angle that measures -0.860548023283932 in radians has a sine value of -.7582, and the angle that measures 5 radians has a sine value of -0.958924274663138.

SELECT ASIN(-.7582), SIN(5);

The valid ranges for ASIN are from -1 through 1.

ATAN, ATN2, TAN, and COT

The ATAN, ATN2, TAN, and COT functions are mathematical functions. The ATAN function returns the measurement of the angle, in radians, whose tangent is the specified float expression. An angle having a tangent value of -27.29 measures -1.53416925536896 in radians.

The ATN2 function returns the angle, in radians, for an angle whose tangent is between the two specified float expressions. An angle with a tangent from 3.273 through 15 measures 0.214832755968629 in radians.

The TAN function returns the trigonometric tangent of the specified float expression. An angle that measures 27.92 radians has a tangent of -0.36994766163616.

The COT function returns the trigonometric cotangent of the specified angle, in radians, indicated in the specified float expression. An angle of 97.1928 radians has a cotangent value of -5.02149424849997.

DEGREES

The DEGREES function returns a numeric expression, the measurement of an angle, in degrees, from the measurement in radians of the angle. An angle measuring -14.578 radians measures -835.257873741714090000 degrees, for example:

SELECT DEGREES(-14.578);

RADIANS

The RADIANS function calculates the angle in radians from the specified measurement in degrees of the angle. For example, to calculate the measurement in radians of an angle that measures 10.75 degrees, use:

SELECT RADIANS(10.75);