當前位置:編程學習大全網 - 編程軟體 - c語言中sin是啥?

c語言中sin是啥?

C語言sin()用來計算參數x 的正玄值,然後將結果返回。返回-1 至1 之間的計算結果。

例子:

#include <math.h>

main(){

double answer = sin(0.5);

printf("sin(0.5) = %f\n", answer);

}

執行

sin(0.5) = 0.479426

C語言sin():

sin()原型:double sin(double x)

sin()角度與弧度:

π=180°

1°=π/180

1(rad)=180/π

角度轉弧度:用角度乘以π/180

弧度轉角度:用弧度乘以180/π,或者用rtod()函數

擴展資料:

與sin相似的acos函數

函數名: acos

功 能:計算並返回arccos(x)值、要求-1<=X<=1

函數與形參類型:

double acos(x)

double x;

程序例:

#include <stdio.h>

#include <math.h> int main(void)

{

double result;

double x = 0.5; result = acos(x);

printf("The arc cosine of %lf is %lf\n", x, result);

return 0;

}

參考資料:

CSDN博客頻道-C語言中sin和cos的用法

  • 上一篇:cnc編程有那些指令G的指令和M的指令?
  • 下一篇:steam怎麽添加第二個手柄
  • copyright 2024編程學習大全網