Calculate the tangent of an angle
Synopsis:
#include <math.h>
double tan( double x );
float tanf( float x );
long double tanl( long double x );
Arguments:
 x
 The angle, in radians, for which you want to compute the tangent.
Library:
libm
Use the l m option to
qcc
to link against this library.
Description:
These functions compute the tangent of x radians.
A large magnitude argument may yield a result with little or no significance.
To check for error situations, use
feclearexcept()
and
fetestexcept():
 Call feclearexcept(FE_ALL_EXCEPT) before calling
tan(), tanf(), or tanl().
 On return, if fetestexcept(FE_INVALID  FE_DIVBYZERO  FE_OVERFLOW  FE_UNDERFLOW)
is nonzero, then an error has occurred.
Returns:
The tangent value.
If x is NAN or infinity, NAN is returned.
For a correct value that would cause an underflow, these functions return 0.0.
 If the correct value would cause underflow, a range error may occur, and tan(),
tanf(), and tanl() return 0.
 If x is NaN, NaN is returned.
 If x is ±0, x is returned.
 If x is subnormal, a range error may occur, and x should be returned.
 If x is ±Inf, a domain error occurs, and NaN is returned.
 If the correct value would cause underflow, and is representable, a range error may occur and the correct value
is returned.
 If the correct value would cause overflow, a range error occurs, and tan(),
tanf(), and tanl() return ±HUGE_VAL,
±HUGE_VALF, and ±HUGE_VALL, respectively,
with the same sign as the correct value of the function.
Examples:
#include <stdio.h>
#include <math.h>
#include <fenv.h>
#include <stdlib.h>
int main( void )
{
int except_flags;
feclearexcept(FE_ALL_EXCEPT);
printf( "%f\n", tan(.5) );
except_flags = fetestexcept(FE_INVALID  FE_DIVBYZERO  FE_OVERFLOW  FE_UNDERFLOW);
if(except_flags) {
/* An error occurred; handle it appropriately. */
}
return EXIT_SUCCESS;
}
produces the output:
0.546302
Classification:
ANSI,
POSIX 1003.1
Safety: 

Cancellation point 
No 
Interrupt handler 
No 
Signal handler 
No 
Thread 
Yes 