tan -- Calculate Tangent

Format

#include <math.h>
double tan(double x);
float tanf(float x);
long double tanl(long double x);
float tan(float x);
long double tan(long double x);

Language Level: ANSI, POSIX, XPG4
tan calculates the tangent of x, where x is expressed in radians.

The absolute value of the argument x must be less than 263.

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.

Note: C++ prototypes

float tan(float x);
long double tan(long double x);

are disabled when you compile using the lang(compatmath) option.

Return Value
tan returns the value of the tangent of x.

If the absolute value of the argument is more than 263, then errno is set to EDOM and tan returns NaN.

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>
lang(compatmath) option