From 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 7 Apr 2024 13:41:34 -0500 Subject: new repository --- devdocs/c/numeric%2Fcomplex%2Fctanh.html | 67 ++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 devdocs/c/numeric%2Fcomplex%2Fctanh.html (limited to 'devdocs/c/numeric%2Fcomplex%2Fctanh.html') diff --git a/devdocs/c/numeric%2Fcomplex%2Fctanh.html b/devdocs/c/numeric%2Fcomplex%2Fctanh.html new file mode 100644 index 00000000..d3d586b4 --- /dev/null +++ b/devdocs/c/numeric%2Fcomplex%2Fctanh.html @@ -0,0 +1,67 @@ +

ctanhf, ctanh, ctanhl

Defined in header <complex.h>
float complex       ctanhf( float complex z );
+
(1) (since C99)
double complex      ctanh( double complex z );
+
(2) (since C99)
long double complex ctanhl( long double complex z );
+
(3) (since C99)
Defined in header <tgmath.h>
#define tanh( z )
+
(4) (since C99)
+1-3) Computes the complex hyperbolic tangent of z.
+4) 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.

Parameters

+ +
z - complex argument

Return value

If no errors occur, complex hyperbolic tangent of z is returned

+

Error handling and special values

Errors are reported consistent with math_errhandling

+

If the implementation supports IEEE floating-point arithmetic,

+
  1. per DR471, this only holds for non-zero x. If z is 0+∞i, the result should be 0+NaNi
  2. per DR471, this only holds for non-zero x. If z is 0+NaNi, the result should be 0+NaNi

Notes

Mathematical definition of hyperbolic tangent is tanh z = ez-e-z/ez+e-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.

+

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)

References

See also

+ + + + +
+
(C99)(C99)(C99)
computes the complex hyperbolic sine
(function)
+
(C99)(C99)(C99)
computes the complex hyperbolic cosine
(function)
+
(C99)(C99)(C99)
computes the complex arc hyperbolic tangent
(function)
+
(C99)(C99)
computes hyperbolic tangent (\({\small\tanh{x} }\)tanh(x))
(function)
C++ documentation for tanh
+

+ © cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
+ https://en.cppreference.com/w/c/numeric/complex/ctanh +

+
-- cgit v1.2.3