tan, tanl
raw OCR
Calculates the tangent.
Defined in header <math.h>
Syntax
Real version: Complex version:
#include <math.h> #include <complex.h>
double tan(double x); complex tan(complex x);
long double tanldong double x);
Portability
| DOS | UNIX | Windows | ANSI C | C++ only | |
|---|---|---|---|---|---|
| tanI | ■ | ■ | |||
| Real tan | ■ | ■ | ■ | ■ | |
| Complex tan | ■ | ■ | ■ |
Remarks
tan calculates the tangent. Angles are specified in radians.
tanI is the long double version; it takes a long double argument and returns a long double result.
Error handling for these routines can be modified through the functions matherr and _matherrl.
The complex tangent is defined by
tan(z) = sln(z) / cos(z)
Return value
tan and tan! return the tangent of x, sin(A:)/cos(x).
See also
Example
#include <stdio.h>
#include <math.h>
int main(void)
{
double result, x = 0.5;
result = tan(x);
printfC'The tangent of %lf is %lf\n", x, result);
return 0;
}
Differences from modern implementations
Nothing recorded yet.
Modern references
These are search links, not yet checked by hand.
Stable link: /3.1/math.h/tan/
· short form /3.1/tan/