2 回答

TA貢獻1757條經(jīng)驗 獲得超8個贊
要用弧度計算的,另外,pintf語句中,應該是"%lf",不是"f%"
sin()是三角函數(shù),參數(shù)使用的是弧度,不是度。
asin()才是反三角函數(shù)。
資料 :
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條經(jīng)驗 獲得超5個贊
幫你更正一下:
int main()
{
const double pi=3.14; //定義pi的值
double a;
a=sin(45*pi/180); //角度轉化為弧度
printf("%f",a); //printf的正確格式
}
- 2 回答
- 0 關注
- 189 瀏覽
添加回答
舉報