Skip to main content
Previous section   Next section

COS

A scalar numeric function that returns the cosine, in radians, of an angle.

Synopsis

{fn COS(float-expression)}

Arguments

Argument Description
float-expression An expression of type FLOAT. This is an angle expressed in radians.

Description

COS takes any numeric value and returns the cosine as a floating point number. The returned value is within the range -1 to 1, inclusive. COS returns NULL if passed a NULL value. COS treats nonnumeric strings as the numeric value 0.

COS returns a value of data type FLOAT with a precision of 19 and a scale of 18.

COS can only be used as an ODBC scalar function (with the curly brace syntax).

You can use the DEGREES function to convert radians to degrees. You can use the RADIANS function to convert degrees to radians.

Examples

These examples show the effect of COS on two sines.

SELECT {fn COS(0.52)} AS Cosine
Copy code to clipboard

returns 0.86781.

SELECT {fn COS(-.31)} AS Cosine 
Copy code to clipboard

returns 0.95233.

See Also