tan
tangent function
You're viewing an older version of this page (#3295). View the current version.
NAME
tan
INTERFACE
#include <math.h>
double tan ( double x ) long tanl ( long double x ) float tanf ( float x )
#include <complex.h> complex tan(complex x) double complex ctan(double complex x) float complex ctan(float complex x) long double complex ctanl(long double complex x)
DESCRIPTION
The tan function computes the tangent of x (measured in radians), this is identical to the calculation of
Example 1
#include <stdio.h>
#include <math.h>
int main()
{
double x=0.5;
double result = tan(x);
printf("The tangent of %lf is %lf\n", x, result);
}SPECIAL VALUES
tan ( ±0 ) returns ±0.
tan ( ±infinity ) returns a NaN and raises the invalid floating-point exception.
SEE ALSO
acos (3) , asin (3) , atan (3) , atan2 (3) , cos (3) , cosh (3) , sin (3) , sinh (3) , tanh (3)
STANDARDS
The tan function conforms to ISO/IEC 9899:1999(E).
COMPATIBILITY
<table class="compat"> <tr><th></th><th>DOS</th><th>UNIX</th><th>Windows</th><th>ANSI C</th><th>C++ only</th></tr> <tr><td>tanl</td><td>•</td><td></td><td>•</td><td></td><td></td></tr> <tr><td>Real tan</td><td>•</td><td>•</td><td>•</td><td>•</td><td></td></tr> <tr><td>Complex tan</td><td>•</td><td></td><td>•</td><td></td><td>•</td></tr> <tr><td>Complex ctan</td><td></td><td>•</td><td></td><td></td><td>•</td></tr> </table>