Namespaces
Variants
Views
Actions

ctanhf, ctanh, ctanhl

From cppreference.com
< c‎ | numeric‎ | complex
Revision as of 08:21, 11 February 2014 by Newatthis (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Defined in header <complex.h>
float complex       ctanhf( float complex z );
(since C99)
double complex      ctanh( double complex z );
(since C99)
long double complex ctanhl( long double complex z );
(since C99)

Computes the complex hyperbolic tangent of z.

Contents

[edit] Parameters

z - complex argument

[edit] Return value

The complex hyperbolic tangent of z.

[edit] Example

#include <stdio.h>
#include <complex.h>
#include <math.h>
 
#define PI acos(-1)
 
int main()
{
    double complex z;
 
    /* Hyperbolic functions are periodic with respect to the imaginary component. */
    /* The period of tanh is pi*i.                                                */
    z = ctanh(0.0+0.0*PI*I);
    printf("ctanh(0.0+0*PI*I) ==> %f%+fi\n", creal(z),cimag(z));
 
    z = ctanh(0.0 + 1*PI*I);
    printf("ctanh(0.0+1*PI*I) ==> %f%+fi\n", creal(z),cimag(z));
 
    z = ctanh(0.0 + 2*PI*I);
    printf("ctanh(0.0+2*PI*I) ==> %f%+fi\n", creal(z),cimag(z));
 
    return 0;
}

Output:

ctanh(0.0+0*PI*I) ==> 0.000000+0.000000i
ctanh(0.0+1*PI*I) ==> 0.000000-0.000000i
ctanh(0.0+2*PI*I) ==> 0.000000-0.000000i

[edit] See also

(C99)(C99)(C99)
computes the complex hyperbolic sine
(function) [edit]
(C99)(C99)(C99)
computes the complex hyperbolic cosine
(function) [edit]