我要评分
获取效率
正确性
完整性
易理解

catanh

Compute the hyperbolic arctangent of a complex number.

Interface Definition

C interface:

float complex catanhf(float complex x);

double complex catanh(double complex x);

Parameters

Parameter

Type

Description

Input/Output

x

  • For catanhf, x is of single-precision floating-point complex type.
  • For catanh, x is of double-precision floating-point complex type.

Floating-point value of the input data.

Input

Return Value

  • The hyperbolic arctangent y of x is returned.
  • The special values are listed in the following table.

    Real Part of the Input (x.real)

    Imaginary Part of the Input (x.imag)

    Real Part of the Output (y.real)

    Imaginary Part of the Output (y.imag)

    inf

    /

    +0.0

    /

    -inf

    /

    -0.0

    /

    +0.0

    nan

    +0.0

    nan

    nan

    ±inf

    +0.0

    /

    nan

    Not ±inf

    nan

    nan

Dependency

C: "km.h"

Example

C interface:
    // typical usage
    double x1 = 1.0, x2 = 2.0, x3 = 3.0, x4 = 4.0;
    double complex cx1 = __builtin_complex(x1, x2);
    double complex cx2 = __builtin_complex(x3, x4);
    double complex cx3 = __builtin_complex(NAN, NAN);
    double complex cx4 = __builtin_complex(INFINITY, -INFINITY);

    // print result
    double ry;
    double iy;
    ry = __real__ catanh(cx1);
    iy = __imag__ catanh(cx1);
    printf("catanh(cx1) = %.15f, %.15f\n", ry, iy);
    ry = __real__ catanh(cx2);
    iy = __imag__ catanh(cx2);
    printf("catanh(cx2) = %.15f, %.15f\n", ry, iy);
    ry = __real__ catanh(cx3);
    iy = __imag__ catanh(cx3);
    printf("catanh(cx3) = %.15f, %.15f\n", ry, iy);
    ry = __real__ catanh(cx4);
    iy = __imag__ catanh(cx4);
    printf("catanh(cx4) = %.15f, %.15f\n", ry, iy);

result:
   /*
    * catanh(cx1) = 0.173286795139986, 1.178097245096172
    * catanh(cx2) = 0.117500907311434, 1.409921049596575
    * catanh(cx3) = nan, nan
    * catanh(cx4) = 0.000000000000000, -1.570796326794897
    */