cis
Compute the cosine and sine of x at the same time and return the results as a complex number.
Interface Definition
C interface:
float complex cisf(float x);
double complex cis(double x);
Parameters
Parameter |
Type |
Description |
Input/Output |
|---|---|---|---|
x |
|
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 = 2.0;
double x3 = -2.5;
double x4 = NAN;
double x5 = 0.0;
double complex z1 = cis(x1);
double complex z2 = cis(x2);
double complex z3 = cis(x3);
double complex z4 = cis(x4);
double complex z5 = cis(x5);
// print result
printf("/*\n");
printf(" * cis(%.2f) = %.6f + %.6f*I\n", x1, __real__(z1), __imag__(z1));
printf(" * cis(%.2f) = %.6f + %.6f*I\n", x2, __real__(z2), __imag__(z2));
printf(" * cis(%.2f) = %.6f + %.6f*I\n", x3, __real__(z3), __imag__(z3));
printf(" * cis(%.2f) = %.6f + %.6f*I\n", x4, __real__(z4), __imag__(z4));
printf(" * cis(%.2f) = %.6f + %.6f*I\n", x5, __real__(z5), __imag__(z5));
printf(" **/\n");
/*
* cis(inf) = nan + nan*I
* cis(2.00) = 0.909297 + -0.416147*I
* cis(-2.50) = -0.598472 + -0.801144*I
* cis(nan) = nan + nan*I
* cis(0.00) = 0.000000 + 1.000000*I
**/
Parent topic: Complex Functions