COS function calculates the cosine of an input argument.
In math, given the ABC triangle, the cosine of an angle (A) is defined as the ratio between the length of the adjacent side (b) to the length of the hypotenuse (h) as follows:
cos A = b / h
For the inverse of the
COS function, see the
The following illustrates the syntax of the
COS function accepts a
numeric_expression that represents the angle in radians for which the cosine is calculated.
COS function returns a floating-point number.
The following example returns the cosines of 0, π, and π/3.
SELECT COS(0) cos_zero,
cos_zero | cos_pi | cos_one_third_pi
1 | -1 | 0.5
Note that we use the
PI function to get the π constant.
Most database systems support the
COS function with the same behavior.