#define tanh( z )
(4) (since C99)1-3) Computes the complex hyperbolic tangent of z
.
Type-generic macro: If
z
has type
long double complex,
ctanhl
is called. if
z
has type
double complex,
ctanh
is called, if
z
has type
float complex,
ctanhf
is called. If
z
is real or integer, then the macro invokes the corresponding real function (
tanhf,
tanh,
tanhl). If
z
is imaginary, then the macro invokes the corresponding real version of the function
tan, implementing the formula
tanh(iy) = i tan(y), and the return type is imaginary.
[edit] Parameters [edit] Return valueIf no errors occur, complex hyperbolic tangent of z
is returned
Errors are reported consistent with math_errhandling
If the implementation supports IEEE floating-point arithmetic,
z
is +0+0i
, the result is +0+0i
z
is x+âi
(for any[1] finite x), the result is NaN+NaNi
and FE_INVALID is raisedz
is x+NaN
(for any[2] finite x), the result is NaN+NaNi
and FE_INVALID may be raisedz
is +â+yi
(for any finite positive y), the result is 1+0i
z
is +â+âi
, the result is 1±0i
(the sign of the imaginary part is unspecified)z
is +â+NaNi
, the result is 1±0i
(the sign of the imaginary part is unspecified)z
is NaN+0i
, the result is NaN+0i
z
is NaN+yi
(for any non-zero y), the result is NaN+NaNi
and FE_INVALID may be raisedz
is NaN+NaNi
, the result is NaN+NaNi
z
is 0+âi
, the result should be 0+NaNi
z
is 0+NaNi
, the result should be 0+NaNi
Mathematical definition of hyperbolic tangent is
tanh z =Hyperbolic tangent is an analytical function on the complex plane and has no branch cuts. It is periodic with respect to the imaginary component, with period πi, and has poles of the first order along the imaginary line, at coordinates (0, Ï(1/2 + n)). 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.
[edit] Example#include <stdio.h> #include <math.h> #include <complex.h> int main(void) { double complex z = ctanh(1); // behaves like real tanh along the real line printf("tanh(1+0i) = %f%+fi (tanh(1)=%f)\n", creal(z), cimag(z), tanh(1)); double complex z2 = ctanh(I); // behaves like tangent along the imaginary line printf("tanh(0+1i) = %f%+fi ( tan(1)=%f)\n", creal(z2), cimag(z2), tan(1)); }
Output:
tanh(1+0i) = 0.761594+0.000000i (tanh(1)=0.761594) tanh(0+1i) = 0.000000+1.557408i ( tan(1)=1.557408)[edit] References
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4