c语言三角函数

2024-12-22 09:26:10
推荐回答(3个)
回答1:

要用弧度计算的,另外,pintf语句中,应该是"%lf",不是"f%"

sin()是三角函数,参数使用的是弧度,不是度。

asin()才是反三角函数。

资料 :

NAME
asin, asinf, asinl - arc sine function

SYNOPSIS
#include

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).

回答2:

帮你更正一下:
int main()
{
const double pi=3.14; //定义pi的值
double a;
a=sin(45*pi/180); //角度转化为弧度
printf("%f",a); //printf的正确格式
}

回答3:

应该是printf("%f",a);