C参考手册
数值 | Numerics
cexpf
在头文件<math.h>中定义 |
|
|
---|---|---|
float complex cexpf( float complex z ); |
(1) |
(since C99) |
double complex cexp( double complex z ); |
(2) |
(since C99) |
long double complex cexpl( long double complex z ); |
(3) |
(since C99) |
Defined in header <tgmath.h> |
|
|
#define exp( z ) |
(4) |
(since C99) |
1-3)计算复杂碱基Ë指数的z
。
4)类型 - 通用宏:如果z
有类型long
double
complex
,cexpl
被调用。如果z
有类型double
complex
,cexp
称为,如果z
有类型float
complex
,cexpf
称为。如果z
是真实的或整数,则宏调用相应的实函数(expf
,exp
,expl
)。如果z
是虚构的,则调用相应的复杂参数版本。
参数
z |
- |
复杂的论点 |
---|
返回值
如果没有出现错误,e提高到电源z
, ez
返回。
错误处理和特殊值
报告的错误与math_errhandling一致。
如果实现支持IEEE浮点运算,
-
cexp(conj(z))
==
conj(cexp(z))
- If
z
is±0+0i
, the result is1+0i
- If
z
isx+∞i
(for any finite x), the result isNaN+NaNi
andFE_INVALID
is raised. - If
z
isx+NaNi
(for any finite x), the result isNaN+NaNi
andFE_INVALID
may be raised. - If
z
is+∞+0i
, the result is+∞+0i
- If
z
is-∞+yi
(for any finite y), the result is+0+cis(y)
- If
z
is+∞+yi
(for any finite nonzero y), the result is+∞+cis(y)
- If
z
is-∞+∞i
, the result is±0±0i
(signs are unspecified) - If
z
is+∞+∞i
, the result is±∞+NaNi
andFE_INVALID
is raised (the sign of the real part is unspecified) - If
z
is-∞+NaNi
, the result is±0±0i
(signs are unspecified) - If
z
is+∞+NaNi
, the result is±∞+NaNi
(the sign of the real part is unspecified) - If
z
isNaN+0i
, the result isNaN+0i
- If
z
isNaN+yi
(for any nonzero y), the result isNaN+NaNi
andFE_INVALID
may be raised - If
z
isNaN+NaNi
, the result isNaN+NaNi
其中cis(y)是cos(y)+ i sin(y)。
Notes
复指数函数ez
对于z = x + iy等于ex
cis(y), or, ex
(cos(y) + i sin(y)).
指数函数是复平面中的一个完整函数,并且没有分支切割。
例
#include <stdio.h>
#include <math.h>
#include <complex.h>
int main(void)
{
double PI = acos(-1);
double complex z = cexp(I * PI); // Euler's formula
printf("exp(i*pi) = %.1f%+.1fi\n", creal(z), cimag(z));
}
输出:
exp(i*pi) = -1.0+0.0i
参考
- C11标准(ISO / IEC 9899:2011):
- 7.3.7.1 cexp函数(p:194)
- 7.25类型通用数学<tgmath.h>(p:373-375)
- G.6.3.1 cexp函数(p:543)
- G.7类型 - 通用数学<tgmath.h>(p:545)
- C99标准(ISO / IEC 9899:1999):
- 7.3.7.1 cexp函数(p:176)
- 7.22类型通用数学<tgmath.h>(p:335-337)
- G.6.3.1 cexp函数(p:478)
- G.7类型 - 通用数学<tgmath.h>(p:480)