ccos函数用法详解
ccos函数简介
- 头文件包含
#include <complex.h>
- 函数定义
double complex ccos(double complex z );
float complex ccosf(float complex z );
long double complex ccosl(long double complex z );
- 编译链接选项
-lm
ccos函数常见使用错误
- 链接错误
undefined reference to `ccos'
解决办法:添加链接选项
-lm
- 编译错误
warning: implicit declaration of function ‘ccos’ [-Wimplicit-function-declaration]
解决办法:包含头文件
#include <complex.h>
ccos函数详细描述
这些函数计算z 的复余弦
复余弦函数定义为:
ccos(z) = (exp(i * z) + exp(\-i * z)) / 2
评论区