当前位置:网站首页>C language POW function (how to play exponential function in C language)
C language POW function (how to play exponential function in C language)
2022-07-27 20:19:00 【Full stack programmer webmaster】
Hello everyone , I meet you again , I'm your friend, Quan Jun .
Expand all
C In language POW Function USES :
#include
#defineACCURACY100
doublefunc1(doublet,intn);
doublefunc2(doubleb,intn);
doublepow2(doublea,doubleb);
intmain(){
printf(“%lf”,pow2(5.21,4.11));
return0;
}
doublepow2(doublea,doubleb){
if(a==0&&b>0){
return0;
}
elseif(a==0&&b<=0){
return1/0;
}
elseif(a<0&&!(b-(int)b<0.0001||(b-(int)b>0.999))){
return1/0;
}
if(a<=2&&a>=0){
doublet=a-1;
doubleanswer=1;
for(inti=1;i
answer=answer+func1(t,i)*func2(b,i);
}
returnanswer;
}
elseif(a>2){
inttime=0;
while(a>2){
a=a/2;
time++;
}
returnpow2(a,b)*pow2(2,b*time);
}
else{
if((int)b%2==0){
returnpow2(-a,b);
}
else{
return-pow2(-a,b);
}
}
}
doublefunc1(doublet,intn){
doubleanswer=1;
for(inti=0;i
answer=answer*t;
}
returnanswer;
}
doublefunc2(doubleb,intn){
doubleanswer=1;
for(inti=1;i<=n;i++){
answer=answer*(b-i+1)/i;
}
returnanswer;
}
Extended data
C++ Provide the following pow Overloaded form of function :
doublepow(doubleX,intY);
floatpow(floatX,floatY);
floatpow(floatX,intY);
longdoublepow(longdoubleX,longdoubleY);
longdoublepow(longdoubleX,intY);
The parameter type should be set reasonably when using 636f707962616964757a686964616f31333431373861, Avoid multiple “pow” The instance matches the parameter list .
Among them, the use of shapes such as :
intX,Y;
intnum=pow(X,Y);
This is a commonly used function , But the compiler will remind you that there are multiple “pow” The instance matches the parameter list .
You can use cast to solve this problem :num=pow((float)X,Y);
Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/128187.html Link to the original text :https://javaforall.cn
边栏推荐
- [openbmc series] 4. Start the process and use qume to simulate ast2600 EVB
- Built in function time date function
- 继华为、联发科之后,这家手机芯片厂商宣布向武汉捐款700万
- 华为手机出货超苹果成全球第二,但面临大量库存需要清理
- Get wechat product details API
- 2019年全球半导体市场收入4183亿美元,同比下滑11.9%
- Understanding of basic concepts of channel capacity and channel bandwidth
- slf4j中如何进行log4j配置呢?
- Graphic leetcode - Sword finger offer II 115. reconstruction sequence (difficulty: medium)
- 2019年中国智能机市场:华为拿下近4成份额,稳坐国内第一
猜你喜欢

Explore a new generation of activities to win customers, virtualization activities win a trick | manufacturer solicitation

图解LeetCode——592. 分数加减运算(难度:中等)

TS2532: Object is possibly ‘undefined‘

使用cpolar建立一个商业网站(5)

What does bus mean

Talk about how redis handles requests

PMP practice once a day | don't get lost in the exam -7.27 (including agility + multiple choices)

长安链数据存储源码分析

Chapter 3 basic operation
![[openbmc series] 4. Start the process and use qume to simulate ast2600 EVB](/img/ab/026111b25836758ec7ffec8d60f49d.png)
[openbmc series] 4. Start the process and use qume to simulate ast2600 EVB
随机推荐
shell
Underlying principle of mvcc
Two years after its release, the price increased by $100, and the reverse growth of meta Quest 2
js跳转页面并刷新(本页面跳转)
Express: search product API by keyword
[map set]
ES6--拓展运算符运用
图解LeetCode——剑指 Offer II 115. 重建序列(难度:中等)
Libpcap library and pcap_ Sendpacket interface function understanding
LG集团宣布将向湖北捐赠300万元现金、120万个口罩、1万套防护服
uva1377
Built in function lock correlation
华为150人团队驰援,武汉“小汤山”5G基站火速开通!
西数移动硬盘无法读取(高枕无忧的成语)
‘vite‘ 不是内部或外部命令,也不是可运行的程序 或批处理文件
C语言--数组
Pyqt5 rapid development and practice 4.7 qspinbox (counter) and 4.8 QSlider (slider)
2019年全球半导体营收同比下滑12%,中国市场份额第一
Unity2d dynamic cartoon script (animation demonstration II for the chapter of Tiger Bridge)
Built in function time date function