Name
ctan
Synopsis
Calculates the tangent of a complex number
#include <complex.h> double complexctan
( double complexz
); float complexctanf
( float complexz
); long double complexctanl
( long double complexz
);
The ctan()
function returns
the tangent of its complex number argument
z
, which is equal to
sin(z
) /
cos(z
).
Example
double complex z = − 0.53 + 0.62 * I; double complex c, d; c = ctan( z ); d = csin( z ) / ccos( z ); printf("The ctan() function returns %.2f %+.2f \xD7 I.\n", creal(c), cimag(c) ); printf("Using the csin() and ccos() functions yields %.2f %+.2f \xD7 I.\n", creal(d), cimag(d) );
This code produces the following output:
The ctan() function returns -0.37 +0.67 × I. Using the csin() and ccos() functions yields -0.37 +0.67 × I.
Get C in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.