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

sinf函数


概要:
#include <math.h>
float sinf(float x);

描述:

该函数计算参数x的正弦值。

参数x应为弧度值;如果参数x为角度值,应乘上(π/180)转换成对应的弧度值。


参数:
float x

参数为一个float类型的浮点数。


返回值:

函数返回参数x的正弦值。


范例:
1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
13 
14 
15 
16 
/*函数sinf范例*/

#include <math.h>
#include <stdio.h>

int main(void)
{
    float value;
    float angle = 30.0f;

    value = sinf(angle*3.14f/180.0f);
    printf("The sine of %d degrees is %.2f.\n", (int)angle, value);

    return 0;
}

输出:

The sine of 30 degrees is 0.50.


相关内容:
sin double类型的正弦函数。
sinl long double类型的正弦函数。