csinf, csin, csinl
From cppreference.net
|
定义于头文件
<complex.h>
|
||
| (1) | (C99 起) | |
| (2) | (C99 起) | |
| (3) | (C99 起) | |
|
定义于头文件
<tgmath.h>
|
||
|
#define sin( z )
|
(4) | (C99 起) |
1-3)
计算
z
的复正弦值。
4)
类型泛型宏:若
z
具有类型
long
double
complex
,则调用
csinl
;若
z
具有类型
double
complex
,则调用
csin
;若
z
具有类型
float
complex
,则调用
csinf
。若
z
为实数或整数,则该宏调用对应的实数函数(
sinf
、
sin
、
sinl
)。若
z
为虚数,则该宏调用函数的对应实数版本
sinh
,实现公式
sin(iy) = i ∙ sinh(y)
,且该宏的返回类型为虚数。
目录 |
参数
| z | - | 复参数 |
返回值
若无错误发生,返回复数
z
的正弦值。
错误和特殊情况的处理方式如同该操作通过 - I * csinh ( I * z ) 实现
注释
正弦函数是复平面上的整函数,且没有分支切割。
Mathematical definition of the sine is sin z =|
e
iz
-e -iz |
| 2i |
示例
运行此代码
#include <stdio.h> #include <math.h> #include <complex.h> int main(void) { double complex z = csin(1); // 沿实轴表现如实正弦函数 printf("sin(1+0i) = %f%+fi ( sin(1)=%f)\n", creal(z), cimag(z), sin(1)); double complex z2 = csin(I); // 沿虚轴表现如双曲正弦函数 printf("sin(0+1i) = %f%+fi (sinh(1)=%f)\n", creal(z2), cimag(z2), sinh(1)); }
输出:
sin(1+0i) = 0.841471+0.000000i ( sin(1)=0.841471) sin(0+1i) = 0.000000+1.175201i (sinh(1)=1.175201)
参考文献
- C17 标准 (ISO/IEC 9899:2018):
-
- 7.3.5.5 csin 函数族 (页码: 138-139)
-
- 7.25 泛型数学 <tgmath.h> (页码: 272-273)
-
- G.7 泛型数学 <tgmath.h> (页码: 397)
- C11 标准 (ISO/IEC 9899:2011):
-
- 7.3.5.5 csin 函数 (p: 191-192)
-
- 7.25 泛型数学 <tgmath.h> (p: 373-375)
-
- G.7 泛型数学 <tgmath.h> (p: 545)
- C99标准(ISO/IEC 9899:1999):
-
- 7.3.5.5 csin函数族(页码:173)
-
- 7.22 泛型数学 <tgmath.h>(页码:335-337)
-
- G.7 泛型数学 <tgmath.h>(页码:480)
参见
|
(C99)
(C99)
(C99)
|
计算复余弦
(函数) |
|
(C99)
(C99)
(C99)
|
计算复正切
(函数) |
|
(C99)
(C99)
(C99)
|
计算复反正弦
(函数) |
|
(C99)
(C99)
|
计算正弦值 (
sin(x)
)
(函数) |
|
C++ documentation
for
sin
|
|