当前位置: C语言 -- 标准库 -- <complex.h> -- cargf

cargf函数


概要:
#include <complex.h>
float cargf(float complex z);

描述:

该函数计算参数z的相位角,沿负实轴区间进行分支切割(branch cut)。


参数:
float complex z

参数为一个float complex类型的复数。


返回值:

函数返回参数z的相位角,返回值位于cargf函数的返回值区间的区间范围内。


范例:
1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
13 
14 
15 
16 
17 
18 
19 
20 
21 
/*函数cargf范例*/

#ifdef __STDC_NO_COMPLEX__
#error "Implementation does not support complex types."
#endif

#include <complex.h>
#include <stdio.h>

int main(void)
{
    float complex x = 1.0f + 1.0fI;
    float y;
    char *ptr = "cargf(1.0f + 1.0fi)";

    y = cargf(x);
    printf("%s = %.2f\n", ptr, y);

    return 0;
}

输出:

cargf(1.0f + 1.0fi) = 0.79


相关内容:
carg double类型的计算相位角的函数。
cargl long double类型的计算相位角的函数。