Rate This Document
Findability
Accuracy
Completeness
Readability

cisd

Compute the cosine and sine of x at the same time and return the results as a complex number. The input parameter is an angle in degrees.

Interface Definition

C interface:

float complex cisdf(float x);

double complex cisd(double x);

Parameters

Parameter

Type

Description

Input/Output

x

  • For cisdf, x is of single-precision floating-point type.
  • For cisd, x is of double-precision floating-point type.

Floating-point value of the input data.

Input

Return Value

A complex number y is returned as the cosine and sine results of x. y.real ∈ [–1, +1]; y.imag ∈ [–1, +1]

  • If the input x is +0, the output y.real is +0 and y.imag is +1.
  • If the input x is –0, the output y.real is –0 and y.imag is +1.
  • If the input x is ±∞, the output y.real and y.imag are both NaN.
  • If the input x is NaN, the output y.real and y.imag are both NaN.

Dependency

C: "kc.h"

Example

C interface:
    // typical usage
    double x1 = INFINITY;
    double x2 = M_PI;
    double x3 = M_PI_2;
    double x4 = NAN;
    double x5 = M_PI_4;
    double complex z1 = cisd(x1);
    double complex z2 = cisd(x2);
    double complex z3 = cisd(x3);
    double complex z4 = cisd(x4);
    double complex z5 = cisd(x5);
    // print result
    printf("/*\n");
    printf(" * cisd(%.2f) = %.6f + %.6f*I\n", x1, __real__(z1), __imag__(z1));
    printf(" * cisd(%.2f) = %.6f + %.6f*I\n", x2, __real__(z2), __imag__(z2));
    printf(" * cisd(%.2f) = %.6f + %.6f*I\n", x3, __real__(z3), __imag__(z3));
    printf(" * cisd(%.2f) = %.6f + %.6f*I\n", x4, __real__(z4), __imag__(z4));
    printf(" * cisd(%.2f) = %.6f + %.6f*I\n", x5, __real__(z5), __imag__(z5));
 
   /*
    * cisd(inf) = nan + nan*I
    * cisd(3.14) = 0.998497 + 0.054804*I
    * cisd(1.57) = 0.999624 + 0.027412*I
    * cisd(nan) = nan + nan*I
    * cisd(0.79) = 0.999906 + 0.013707*I
    **/