c报错 invalid operands of types 'double' and 'double()(double)' to binary 'operator/'是怎么回事啊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)
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/06 08:03:43
c报错 invalid operands of types 'double' and 'double()(double)' to binary 'operator/'是怎么回事啊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)
c报错 invalid operands of types 'double' and 'double()(double)' to binary 'operator/'是怎么回事啊
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/’
c报错 invalid operands of types 'double' and 'double()(double)' to binary 'operator/'是怎么回事啊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)
log2是什么?是不是写错了,应该是log(2)