#include?stdio.h

專注于為中小企業(yè)提供網(wǎng)站建設(shè)、網(wǎng)站制作服務(wù),電腦端+手機(jī)端+微信端的三站合一,更高效的管理,為中小企業(yè)寧德免費(fèi)做網(wǎng)站提供優(yōu)質(zhì)的服務(wù)。我們立足成都,凝聚了一批互聯(lián)網(wǎng)行業(yè)人才,有力地推動(dòng)了千余家企業(yè)的穩(wěn)健成長,幫助中小企業(yè)通過網(wǎng)站建設(shè)實(shí)現(xiàn)規(guī)模擴(kuò)充和轉(zhuǎn)變。
#include?math.h
#define?P?3.1415927
double?sinx(double?x)?{
double?eps?=?1E-8,delta?=?x;
double?sgn?=?-1,sin?=?x,n?=?1;
double?nator?=?1;
while(fabs(delta)??eps)?{
nator?*=?(n?+?1.0)*(n?+?2.0);
delta?簡羨*=?x*x/nator;
sin?+=?sgn*delta;
sgn?=?-sgn;
n?+=?2;
}
return?sin;
}
double?cosx(double?x)?{
double?eps?=?1E-8,delta?=?1;
double?sgn?=?-1,cos?=?1,n?=?1;
double?nator?=?1;
while(fabs(delta)??eps)?{
nator?*=?n*(n?+?1.0);
delta?*=?x*x/nator;
cos?=?cos?+?sgn*delta;
sgn?=?-sgn;
n?+=?2;
}
return?cos;
}
int?main()?{
double?alpha;
int?T;
printf("測試次數(shù):");
scanf("%d",T);
while(T--)?{
printf("請輸入沖咐敗度數(shù):");
scanf("%lf",alpha);
alpha?*=?P/180;
printf("msin(%lf)?=?%lf\n",alpha,sinx(alpha));
printf("sin(%lf)?=?%lf\n",alpha,sin(alpha));//調(diào)用散顫系統(tǒng)函數(shù)用于對比
printf("mcos(%lf)?=?%lf\n",alpha,cosx(alpha));
printf("cos(%lf)?=?%lf\n",alpha,cos(alpha));//調(diào)用系統(tǒng)函數(shù)用于對比
}
return?0;
}
網(wǎng)頁名稱:c語言編寫余弦函數(shù) c++中余弦函數(shù)怎么表示
網(wǎng)站地址:http://chinadenli.net/article45/dsphhhi.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供ChatGPT、云服務(wù)器、企業(yè)網(wǎng)站制作、服務(wù)器托管、網(wǎng)站收錄、Google
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)