当前位置:网站首页>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
边栏推荐
- Talk about how redis handles requests
- LED高精度体重秤方案规格书
- ECU software and hardware architecture
- 我也是醉了,Eureka 延迟注册还有这个坑
- 发布2年后涨价100美元,Meta Quest 2的逆生长
- es6删除对象的属性_ES6删除对象中的某个元素「建议收藏」
- C243: examination ranking
- Wu Hequan: digital technology empowering "double carbon" practice according to local conditions
- MongoDB 学习笔记: BSON 结构分析
- 预处理与宏定义
猜你喜欢

预处理与宏定义

技术分享 | 接口自动化测试中,如何做断言验证?

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

Unified Modeling Language (UML) specification

1.2 pedestrian recognition based on incremental generation of occlusion and confrontation suppression (code understanding and experimental progress + Report)

Add joint control to gltf model

Pyqt5 rapid development and practice 4.5 button controls and 4.6 qcombobox (drop-down list box)

Connection pool - return connection details (Part 1)

What does bus mean

Talk about how redis handles requests
随机推荐
kubectl 获取pod日志 —— 筑梦之路
[redis] redis penetration, avalanche and breakdown
C语言pow函数(c语言中指数函数怎么打)
内置函数锁相关
GLTF模型添加关节控制
'vite' is not an internal or external command, nor is it a runnable program or batch file
[map set]
Simple application of multipoint bidirectional republication and routing strategy
JD: get the raw data API of commodity details
LED高精度体重秤方案规格书
内置函数其它函数
Assignment 1 - Hello World ! - Simple thread Creation
‘vite‘ 不是内部或外部命令,也不是可运行的程序 或批处理文件
LG集团宣布将向湖北捐赠300万元现金、120万个口罩、1万套防护服
slf4j简介说明
An in-depth understanding of crystal oscillation circuit derived from xtalin pin and xtalout pin of single chip microcomputer
如何快速提升抖音小店三分钟回复率?哪些情况会影响抖音小店回复率呢?
PC Museum (3) MITs Altair 8800
京东:按关键字搜索商品 API
Solve the problem of displaying the scroll bar when there is no data in the viewui table