# COS

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

This function takes a single [Number](../../variable-data-types/the-number-variable-data-type) as input. It parses that Number in radians and outputs its cosine.

#### Declaration

```javascript
COS(number) -> cosine
```

&#x20;

#### 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:

```javascript
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](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:

```javascript
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](pi) function. The following example, for instance, returns the cosine of 2π radians:

```javascript
COS(2 * PI()) -> 1
```
