keil中怎么使用三角函数 要给个c编程例子 谢谢

如题所述

第1个回答  2010-09-04
math.h 和C一样调用。

程序:
sin
Summary #include <math.h>
float sin (float x); /* value to calculate sine for */

Description The sin function calculates the sine of the floating-point value x. The value of x must be in the -65535 to +65535 range or an NaN error value is generated.
Return Value The sin function returns the sine of x.
See Also cos, cos517, sin517, tan, tan517
Example

#include <math.h>
#include <stdio.h> /* for printf */

void tst_sin (void) {
float x;
float y;

for (x = 0; x < (2 * 3.1415); x += 0.1) {
y = sin (x);
printf ("SIN(%f) = %f\n", x, y);
}
}

注:角度不是用度算的,以弧度为单位本回答被提问者和网友采纳
第2个回答  2010-09-07
#include <math.h>

void test_sin(void)
{
float x,y;

y = sin(x);
}
X的单位是弧度

具体可以看KEIL的帮助文件,很详细,呵呵
第3个回答  2010-09-05
math.h这个头文件。
直接用 sin(x)就得了
X是float的。。
相似回答