比如下面函数才能得到与Delphi一致结果: double PT2VReg3e(double Pressure ,double Temperature ) { double Beta,Kese,X; int IFor; double a,b,c,d,e,f; Beta=(Pressure-Pc_Water)/10; Kese=(Temperature-Tc_Water); X=0.0; for(IFor=1;IFor<=41;IFor++) { a=NReg3ePT2V[IFor]; b=IReg3ePT2V[IFor]; c=JReg3ePT2V[IFor]; d=KReg3ePT2V[IFor]; e=-(Kese-3.727888*Beta)+0.005*Kese*Kese+0.02*Beta*Beta ; f=pow(Beta,b)*pow(Kese,c)*pow(e, d/8); X=X+a*f; //X=X+NReg3ePT2V[IFor]*pow(Beta,IReg3ePT2V[IFor])*pow(Kese,JReg3ePT2V[IFor])*pow(-(Kese-3.727888*Beta)+0.005*Kese*Kese+0.02*Beta*Beta, KReg3ePT2V[IFor]/8); } return X+1/Dc_Water; }
刚开始是下面这样,就不对,可能中间精度有丢失: double PT2VReg3e(double Pressure ,double Temperature ) { double Beta,Kese,X; int IFor; Beta=(Pressure-Pc_Water)/10; Kese=(Temperature-Tc_Water); X=0.0; for(IFor=1;IFor<=41;IFor++) { X=X+NReg3ePT2V[IFor]*pow(Beta,IReg3ePT2V[IFor])*pow(Kese,JReg3ePT2V[IFor])*pow(-(Kese-3.727888*Beta)+0.005*Kese*Kese+0.02*Beta*Beta, KReg3ePT2V[IFor]/8); } return X+1/Dc_Water; }
|