Format
#include <math.h> double tan(double x);
Language Level: ANSI, POSIX, XPG4
tan calculates the tangent of x, where x is
expressed in radians. If x is too large, a partial
loss of significance in the result can occur. The value of errno
may also be set to EDOM.
Return Value
tan returns the value of the tangent of x.
Example
This example computes x as the tangent of
pi/4.
#include <stdio.h> #include <math.h>
int main(void)
{
double pi,x;
pi = 3.1415926;
x = tan(pi/4.0);
printf("tan( %lf ) is %lf/n", pi/4, x);
return 0;
/****************************************
The output should be:
tan( 0.785398 ) is 1.000000 ****************************************/ }
![]()
acos -- Calculate Arccosine
asin -- Calculate Arcsine
atan - atan2 -- Calculate Arctangent
cos -- Calculate Cosine
cosh -- Calculate Hyperbolic Cosine
_fpatan -- Calculate Arctangent
_fptan -- Calculate Tangent
sin -- Calculate Sine
sinh -- Calculate Hyperbolic Sine
tanh -- Calculate Hyperbolic Tangent
<math.h>