keil C51 三角函数问题

2025-04-13 12:37:21
推荐回答(1个)
回答(1):

多大多能计算?你想得美。
只要在-65535 to +65535 这个范围就行。
另外,角度不是用度算的,以弧度为单位

sin
Summary #include
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
#include /* 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);
}
}

Copyright (c) Keil Software, Inc. and Keil Elektronik GmbH. All rights reserved.