function
<cmath> <ctgmath>

tan

```double tan (double x);
```
```     double tan  (double x);
float tanf (float x);
long double tanl (long double x);
```
```     double tan (double x);
float tan (float x);
long double tan (long double x);
```
```     double tan (double x);
float tan (float x);
long double tan (long double x);
Compute tangent
Returns the tangent of an angle of x radians.

Header <tgmath.h> provides a type-generic macro version of this function.
This function is overloaded in `<complex>` and `<valarray>` (see complex tan and valarray tan).
Additional overloads are provided in this header (`<cmath>`) for the integral types: These overloads effectively cast x to a `double` before calculations (defined for T being any integral type).

This function is also overloaded in `<complex>` and `<valarray>` (see complex tan and valarray tan).

Parameters

x
Value representing an angle, expressed in radians.
One radian is equivalent to `180/PI` degrees.

Example

 ``1234567891011121314`` ``````/* tan example */ #include /* printf */ #include /* tan */ #define PI 3.14159265 int main () { double param, result; param = 45.0; result = tan ( param * PI / 180.0 ); printf ("The tangent of %f degrees is %f.\n", param, result ); return 0; }``````

Output:
 ``` The tangent of 45.000000 degrees is 1.000000. ```