ctanf, ctan, ctanl
Header: <complex.h>
1-3) Computes the complex tangent of z.
# Declarations
float complex ctanf( float complex z );
(since C99)
double complex ctan( double complex z );
(since C99)
long double complex ctanl( long double complex z );
(since C99)
#define tan( z )
(since C99)
# Parameters
z: complex argument
# Return value
If no errors occur, the complex tangent of z is returned.
# Notes
Tangent is an analytical function on the complex plain and has no branch cuts. It is periodic with respect to the real component, with period πi, and has poles of the first order along the real line, at coordinates (π(1/2 + n), 0). However no common floating-point representation is able to represent π/2 exactly, thus there is no value of the argument for which a pole error occurs.
# Example
#include <stdio.h>
#include <math.h>
#include <complex.h>
int main(void)
{
double complex z = ctan(1); // behaves like real tangent along the real line
printf("tan(1+0i) = %f%+fi ( tan(1)=%f)\n", creal(z), cimag(z), tan(1));
double complex z2 = ctan(I); // behaves like tanh along the imaginary line
printf("tan(0+1i) = %f%+fi (tanh(1)=%f)\n", creal(z2), cimag(z2), tanh(1));
}