頭文件包含。math.h

創(chuàng)新互聯(lián)建站專注于企業(yè)全網(wǎng)營銷推廣、網(wǎng)站重做改版、曲沃網(wǎng)站定制設(shè)計(jì)、自適應(yīng)品牌網(wǎng)站建設(shè)、H5建站、商城網(wǎng)站定制開發(fā)、集團(tuán)公司官網(wǎng)建設(shè)、成都外貿(mào)網(wǎng)站建設(shè)公司、高端網(wǎng)站制作、響應(yīng)式網(wǎng)頁設(shè)計(jì)等建站業(yè)務(wù),價格優(yōu)惠性價比高,為曲沃等各大城市提供網(wǎng)站開發(fā)制作服務(wù)。
cos
:余弦函數(shù)
函數(shù)原型:double
cos(double
x);
頭文件:#includemath.h
是否是標(biāo)準(zhǔn)函數(shù):是
函數(shù)功能:求x的余弦值,這里,x為弧度。
返回值:計(jì)算結(jié)果的雙精度值。
例程如下:
求cosx。
#include
stdio.h
#include
math.h
int
main(void)
{
double
result;
double
x
=
M_PI;
result
=
cos(x);
printf("cos(PI)
is
%lf\n",
result);
return
0;
}
sin:正弦函數(shù)
函數(shù)原型:double
sin(double
x);
頭文件:#includemath.h
是否是標(biāo)準(zhǔn)函數(shù):是
函數(shù)功能:求x的正弦值,這里,x為弧度。
返回值:計(jì)算結(jié)果的雙精度值。
例程如下:
求sinx。
#include
stdio.h
#include
math.h
int
main(void)
{
float
x;
x=M_PI/2;
printf("sin(PI/2)=%f",sin(x));
getchar();
return
0;
}
如何在C語言中解決正弦或余弦函數(shù)的表示方法我是一個?頭文件包含。math.h
cos :余弦函數(shù)
函數(shù)原型:double cos(double x);
頭文件:#includemath.h
是否是標(biāo)準(zhǔn)函數(shù):是
函數(shù)功能:求x的余弦值,這里,x為弧度。
返回值:計(jì)算結(jié)果的雙精度值。
例程如下: 求cosx。
#include stdio.h
#include math.h
int main(void)
{
double result;
double x = M_PI。
如果只是需要值,那么調(diào)用math中的sin和cos函數(shù)即可.
參數(shù)為弧度, 如果要使用的參數(shù)是角度,需要自行轉(zhuǎn)換一下.
如果想自己寫,可以參考泰勒展開, 計(jì)算近似值.一般計(jì)算到最后一項(xiàng)小于1e-6即可.
當(dāng)前名稱:c語言正余弦函數(shù)使用 常用正余弦函數(shù)值
網(wǎng)站網(wǎng)址:http://www.yijiale78.com/article14/hhcpge.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供移動網(wǎng)站建設(shè)、外貿(mào)網(wǎng)站建設(shè)、Google、網(wǎng)頁設(shè)計(jì)公司、網(wǎng)站設(shè)計(jì)公司、網(wǎng)站內(nèi)鏈
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)