The COS function returns the cosine of a number given in radians.

This function takes a single number as input. It parses that number in radians and outputs its cosine.

Declaration

COS(number) -> cosine

 

Parameters

number (required, type: number)
The number to calculate the cosine of. This number is parsed in radians.

Return Values

cosine (type: number)
The cosine of the given number.

Examples

The following example returns the cosine of 90. Note that while the cosine of 90 degrees is 0, the cosine of 90 radians is -0.4480736161291702, and this is the number the COS function returns:

COS(90) -> -0.4480736161291702

In order to calculate the cosine of a number of degrees, said number must first be converted into radians using the function RADIANS. The following example returns the cosine of 90 degrees by first converting 90 degrees into radians and then calculating the cosine of the resulting number. Note that the output is not exactly 0, but it is extremely close. This is the result of small rounding errors:

COS(RADIANS(90)) -> 6.123233995736766e-17

As a unit, the radian is derived from the ratio of the arc length to the radius of a circle, and thus it often makes sense to express radians as multiples of pi. (Many "neat" angles are expressed nicely as multiples of pi – the quarter turn, 90°, is 0.5π radians, and a complete rotation, 360°, is 2π radians.) To do so, the COS function can be used in tandem with the PI function. The following example, for instance, returns the cosine of 2π radians:

COS(2 * PI()) -> 1
 

Was this article helpful?

0 out of 0 found this helpful

Articles in this section