# TAN

**The TAN function returns the tangent 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 tangent as a Number.

#### Declaration

```javascript
TAN(number) -> tangent
```

&#x20;

#### Parameters

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

#### Return Values

**tangent** (type: _Number_) The tangent of the given number.

#### Examples

The following example returns the tangent of 45. Note that while the tangent of 45 degrees is 1, the tangent of 45 radians is 1.6197751905438615, and this is the number the TAN function returns:

```javascript
TAN(45) -> 1.6197751905438615
```

In order to calculate the tangent of a number of degrees, said number must first be converted into radians using the function [RADIANS](radians). The following example returns the tangent of forty-five degrees by first converting forty-five degrees into radians and then calculating the tangent of the resulting number. Note that the output is not exactly 1, but it is extremely close. This is the result of small rounding errors:

```javascript
TAN(RADIANS(45)) -> 0.9999999999999999
```

On the subject of rounding errors, it because of them that the TAN function does not return infinity or undefined even when that would be the mathematically correct value of the tangent of a given number. For instance, the tangent of 90° is undefined – mathematically, the answer approaches infinity – but when the function TAN is used to calculate the tangent of ninety degrees, as in the following example, it does not return infinity or undefined, but instead a large (but finite) number. This behavior matches that of most computational calculators and should be sufficient for most practical purposes:

```javascript
TAN(RADIANS(90)) -> 16331239353195370
```
