当前位置:网站首页>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
边栏推荐
- PyQt5快速开发与实战 4.7 QSpinBox(计数器) and 4.8 QSlider(滑动条)
- 我也是醉了,Eureka 延迟注册还有这个坑
- C语言pow函数(c语言中指数函数怎么打)
- codeforces每日5题(均1500)-第二十四天
- JD: get the raw data API of commodity details
- Zepto入门详解
- 如何运行 kevinchappell / formBuilder
- Wu Hequan: digital technology empowering "double carbon" practice according to local conditions
- 站在巨人肩膀上学习,京东爆款架构师成长手册首发
- JS实现视频录制-以Cesium为例
猜你喜欢

PyQt5快速开发与实战 4.5 按钮类控件 and 4.6 QComboBox(下拉列表框)

Graphic leetcode - Sword finger offer II 115. reconstruction sequence (difficulty: medium)

Source code analysis of Chang'an chain data storage

Underlying principle of mvcc

C background GC cause and effect

Wu Hequan: digital technology empowering "double carbon" practice according to local conditions

Connection pool - return connection details (Part 1)

unity2D 动态漫画剧本(给猛虎桥章节做动画演示二)

我也是醉了,Eureka 延迟注册还有这个坑

Ms721 load test
随机推荐
MongoDB 学习笔记: BSON 结构分析
Solve the problem of displaying the scroll bar when there is no data in the viewui table
盘点下互联网大厂的实习薪资:有了它,你也可以进厂
图解LeetCode——592. 分数加减运算(难度:中等)
京东:获得商品详情原数据 API
Compiling ncnn with vs
JS实现视频录制-以Cesium为例
LeetCode练习2——两数之和
Pyqt5 rapid development and practice 4.7 qspinbox (counter) and 4.8 QSlider (slider)
What does bus mean
Built in function lock correlation
PyQt5快速开发与实战 4.7 QSpinBox(计数器) and 4.8 QSlider(滑动条)
《安富莱嵌入式周报》第275期:2022.07.18--2022.07.24
调整数组使奇数全部都位于偶数前
C191: password compilation
Libpcap library and pcap_ Sendpacket interface function understanding
Codeworks round 810 (Div. 2) B.Party super detailed problem solution
Rodin installs the SMT solvers plug-in
Unity2d dynamic cartoon script (animation demonstration II for the chapter of Tiger Bridge)
Datepicker date selector in viewui compatible solution in ie11 browser