c报错 invalid operands of types 'double' and 'double()(double)' to binary 'operator/'是怎么回事啊
doublemutual(doublea,doubleb,doublef){doubley;y=(-(b*a+f*(1-a))*log(b*a+f*(1-a))-((1-...
double mutual(double a,double b,double f)
{
double y;
y=(-(b*a+f*(1-a))*log(b*a+f*(1-a))-((1-b)*a+(1-f)*(1-a))*log((1-b)*a+(1-f)*(1-a))-a*(-b*log(b)-(1-b)*log(1-b))-(1-a)*(-f*log(f)-(1-f)*log(1-f)))/log2;
return(y);
}
double givenmutual(double a,double b,double c,double d,double e,double f,double g,double h)
{
double y;
y=(a*log(a*(a+b+c+d)/((a+b)*(a+c)))+b*log(b*(a+b+c+d)/((a+b)*(b+d)))+c*log(c*(a+b+c+d)/((d+c)*(a+c)))+d*log(d*(a+b+c+d)/((b+d)*(c+d)))+e*log(e*(e+f+g+h)/((e+f)*(e+g)))+f*log(f*(e+f+g+h)/((e+f)*(f+h)))+g*log(g*(e+f+g+h)/((g+h)*(e+g)))+h*log(h*(e+f+g+h)/((g+h)*(f+h))))/log2;
return(y);
}
gcc调试的时候总报错
mutual.c:7: error: invalid operands of types ‘double’ and ‘double ()(double)’ to binary ‘operator/’
mutual.c: In function ‘double givenmutual(double, double, double, double, double, double, double, double)’:
mutual.c:15: error: invalid operands of types ‘double’ and ‘double ()(double)’ to binary ‘operator/’ 展开
{
double y;
y=(-(b*a+f*(1-a))*log(b*a+f*(1-a))-((1-b)*a+(1-f)*(1-a))*log((1-b)*a+(1-f)*(1-a))-a*(-b*log(b)-(1-b)*log(1-b))-(1-a)*(-f*log(f)-(1-f)*log(1-f)))/log2;
return(y);
}
double givenmutual(double a,double b,double c,double d,double e,double f,double g,double h)
{
double y;
y=(a*log(a*(a+b+c+d)/((a+b)*(a+c)))+b*log(b*(a+b+c+d)/((a+b)*(b+d)))+c*log(c*(a+b+c+d)/((d+c)*(a+c)))+d*log(d*(a+b+c+d)/((b+d)*(c+d)))+e*log(e*(e+f+g+h)/((e+f)*(e+g)))+f*log(f*(e+f+g+h)/((e+f)*(f+h)))+g*log(g*(e+f+g+h)/((g+h)*(e+g)))+h*log(h*(e+f+g+h)/((g+h)*(f+h))))/log2;
return(y);
}
gcc调试的时候总报错
mutual.c:7: error: invalid operands of types ‘double’ and ‘double ()(double)’ to binary ‘operator/’
mutual.c: In function ‘double givenmutual(double, double, double, double, double, double, double, double)’:
mutual.c:15: error: invalid operands of types ‘double’ and ‘double ()(double)’ to binary ‘operator/’ 展开
- 你的回答被采纳后将获得:
- 系统奖励15(财富值+成长值)+难题奖励10(财富值+成长值)+提问者悬赏5(财富值+成长值)
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询