求助求助——有关C语言编辑的错误
本人不是计算机专业,不熟悉C语言编程,最近在用软件的时候需要UDF编程,我编好C语言之后检查编译老是出现错误,请各位大师指点一下啊。不胜感激。
程序代码:
#include"udf.h" #define PI 3.141593 #define Rg 9.314 #define Pc 7.376e6 #define Tc 304.2 #define Mw 44 #define omiga 0.225 #define Vc 2.15517e-3 #define NRK 0.77 #define CC1 453.577 #define CC2 1.65014 #define CC3 -1.24814e-3 #define CC4 3.78201e-7 #define CC5 0.00 DEFINE_PROPERTY(density,cell,thread) { double P; double T; double m,at,ac; double A,B; double coef[4]; double a,b; double density; double test1,test2,test3,test4,test5; double A1,B1,A2,B2; double co,theta,root[3]; double zm,dd,al,all; int i,j; T=C_T(cell,thread); P=C_P(cell,thread)+101325; m=0.37464+1.54226*omiga-0.26992*pow(omiga,2); at=pow(1+m*(pow(T/Tc,0.5)),2); ac=0.45724*Rg*Rg*Tc*Tc/Pc; b=0.0778*Rg*Tc/Pc; a=ac*at; A=a*P/pow(Rg*T,2); B=b*P/(Rg*T); coef[3]=-A*B+B*B+B*B*B; coef[2]=A-2*B-3*B*B; coef[1]=B-1; coef[0]=1; A1=(3*coef[2]-coef[1]*coef[1])/3; B1=(2*pow(coef[1],3.0)-9*coef[1]*coef[2]+27*coef[3])/27; test1=fabs(pow(A1,3)/27); test2=pow(B1,2.0)/4; if(A1<0&&test1>test2) { co=2*pow((-A1)/3,0.5); theta=acos((3*B1)/(A1*co))/3.0; root[0]=co*cos(theta)-coef[1]/3.0; root[1]=co*cos(theta+2*PI/3)-coef[1]/3; root[2]=co*cos(theta+4*PI/3)-coef[1]/3; for(i=0;i<3;i++) { if(root[i]<0)root[i]=100000; } for(i=0;i<2;i++) for(j=i+1;j<3;j++) if(root[i]>root[j]) { double temp=root[i]; root[i]=root[j]; root[j]=temp; } zm=root[2]; } else { dd=sqrt(test2+pow(A1,3.0)/27); al=1.0; all=1.0; test3=-B1/2+dd; if(test3<0)al=-1; test3=fabs(test3); A2=al*pow(test3,0.3333334); test4=-B1/2-dd; if(test4<0)all=-1.0; test4=fabs(test4); B2=all*pow(test4,0.3333334); zm=A2+B2-coef[1]/3; if(test4>1e-4) { test5=fabs(1-fabs(A2/B2)); if(test5<5e-4)zm=-1*(A2+B2)/2-coef[1]/3; } } zm=P/(zm*Rg*T); density=1000*Mw*zm*1e-6; return density; }提示的错误是最后一句“return density”————function returning float return double
再一次感谢,请各位大师指点了