csin

计算复数的正弦值。

接口定义

C interface:

float complex csinf(float complex x);

double complex csin(double complex x);

参数

参数名

类型

描述

输入/输出

x

  • 在csinf中,x是复数单精度浮点类型。
  • 在csin中,x是复数双精度浮点类型。

表示输入数据的浮点值。

输入

返回值

依赖

C: "kc.h"

示例

C interface:
    // typical usage
    double x1 = 1.0, x2 = 2.0, x3 = 3.0, x4 = -4.0;
    double complex cx1 = __builtin_complex(x1, x2);
    double complex cx2 = __builtin_complex(x3, x4);
    double complex cx3 = __builtin_complex(INFINITY, -INFINITY);

    // print result
    double ry;
    double iy;
    ry = __real__ csin(cx1);
    iy = __imag__ csin(cx1);
    printf("csin(cx1) = %.15f, %.15f\n", ry, iy);
    ry = __real__ csin(cx2);
    iy = __imag__ csin(cx2);
    printf("csin(cx2) = %.15f, %.15f\n", ry, iy);
    ry = __real__ csin(cx3);
    iy = __imag__ csin(cx3);
    printf("csin(cx3) = %.15f, %.15f\n", ry, iy);


result
    /*
     * csin(cx1) = 3.165778513216168, 1.959601041421606
     * csin(cx2) = 3.853738037919377, 27.016813258003936
     * csin(cx3) = nan, -inf
     * */