cisd
同时计算x的cos和sin值(输入参数为角度),结果以复数的形式返回。
接口定义
C interface:
float complex cisdf(float x);
double complex cisd(double x);
参数
参数名 |
类型 |
描述 |
输入/输出 |
---|---|---|---|
x |
|
表示输入数据的浮点值。 |
输入 |
返回值
计算x的cos和sin,并组成复数结果返回y,y.real ∈ [-1, +1],y.imag∈ [-1, +1]。
- 输入x为+0,返回y.real为+0,y.imag为+1。
- 输入x为-0,返回y.real为-0,y.imag为+1。
- 输入x为±∞,返回y.real为nan,y.imag为nan。
- 输入x为nan,返回y.real为nan,y.imag为nan。
依赖
C: "kc.h"
示例
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 **/
父主题: 复数函数