Rate This Document
Findability
Accuracy
Completeness
Readability

ctan

Compute the tangent of a complex number.

Interface Definition

C interface:

float complex ctanf(float complex x);

double complex ctan(double complex x);

Parameters

Parameter

Type

Description

Input/Output

x

  • For ctanf, x is of single-precision floating-point complex type.

Floating-point value of the input data.

Input

x

  • For ctan, x is of double-precision floating-point complex type.

Floating-point value of the input data.

Input

Return Value

  • Normal range: The tangent of the complex number x is returned.
  • Special values: See 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

    -inf

    -0

    -1

    -inf

    < +0

    nan

    nan

    -inf

    -0

    nan

    nan

    -inf

    +0

    nan

    nan

    -inf

    > +0

    nan

    nan

    -inf

    inf

    -0

    +1

    -inf

    -nan

    nan

    nan

    -inf

    nan

    nan

    nan

    < +0

    -nan

    nan

    nan

    < +0

    nan

    nan

    nan

    -0

    -inf

    -0

    -1

    -0

    -0

    -0

    -0

    -0

    +0

    -0

    +0

    -0

    inf

    -0

    1

    -0

    -nan

    -0

    nan

    -0

    nan

    -0

    nan

    +0

    -inf

    0

    -1

    +0

    -0

    0

    -0

    +0

    +0

    0

    +0

    +0

    inf

    0

    1

    +0

    -nan

    0

    nan

    +0

    nan

    0

    nan

    > +0

    -inf

    0

    -1

    > +0

    inf

    0

    1

    > +0

    -nan

    nan

    nan

    > +0

    nan

    nan

    nan

    inf

    -inf

    0

    -1

    inf

    < +0

    nan

    nan

    inf

    -0

    nan

    nan

    inf

    +0

    nan

    nan

    inf

    > +0

    nan

    nan

    inf

    inf

    0

    1

    inf

    -nan

    nan

    nan

    inf

    nan

    nan

    nan

    -nan

    -inf

    0

    -1

    -nan

    < +0

    nan

    nan

    -nan

    -0

    nan

    nan

    -nan

    +0

    nan

    nan

    -nan

    > +0

    nan

    nan

    -nan

    inf

    0

    1

    -nan

    -nan

    nan

    nan

    -nan

    nan

    nan

    nan

    nan

    -inf

    0

    -1

    nan

    < +0

    nan

    nan

    nan

    -0

    nan

    nan

    nan

    +0

    nan

    nan

    nan

    > +0

    nan

    nan

    nan

    inf

    0

    1

    nan

    -nan

    nan

    nan

    nan

    nan

    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(INFINITY, -INFINITY);

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

result
    /*
     * ctan(cx1) = 0.033812826079897, 1.014793616146634
     * ctan(cx2) = -0.000187346204629, -0.999355987381473
     * ctan(cx3) = 0.000000000000000, -1.000000000000000
     * */