2 回答
TA贡献1757条经验 获得超8个赞
要用弧度计算的,另外,pintf语句中,应该是"%lf",不是"f%"
sin()是三角函数,参数使用的是弧度,不是度。
asin()才是反三角函数。
资料 :
NAME
asin, asinf, asinl - arc sine function
SYNOPSIS
#include <math.h>
double asin(double x);
float asinf(float x);
long double asinl(long double x);
Link with -lm.
DESCRIPTION
The asin() function calculates the arc sine of x; that is the value
whose sine is x. If x falls outside the range -1 to 1, asin() fails
and errno is set.
RETURN VALUE
The asin() function returns the arc sine in radians and the value is
mathematically defined to be between -PI/2 and PI/2 (inclusive).
TA贡献1851条经验 获得超5个赞
帮你更正一下:
int main()
{
const double pi=3.14; //定义pi的值
double a;
a=sin(45*pi/180); //角度转化为弧度
printf("%f",a); //printf的正确格式
}
- 2 回答
- 0 关注
- 149 浏览
添加回答
举报