程序在运行的时候,提示overflow。我检查了一下分母为零的情况,只有这里**************处,我想问一下怎么处理。
double f11(double x,double e,double z)
{
if((e<=0.002)&&(e>=0.0))
return 16.7*((2.0*(e-z*x))/0.002-((e-z*x)/0.002)*((e-z*x)/0.002));
else if((e<=0.0033)&&(e>=0.002))
return 16.7*((1.0-0.15*((e-z*x)-0.002)/0.0013));
else return 0;
}
double f12(double x,double z,double e)
{
return 16.7*((2.0*(e-z*x))/0.002-((e-z*x)/0.002)*((e-z*x)/0.002));
}
#include "stdio.h"
#include "9ffts.c"
main()
{
double a,eps,e,k,fy1,fy2,es1,es2,h,ey1,ey2;
double z,xx1,xx2,gh1,gh2,t11,b;
double a12,b12,t12,h0,yn;
scanf("%f",&e);
k=0.50;
h0=315.0;
while((e<=0.0033)&&(e>0))
z=e/(k*h0);
xx1=300.00;
xx2=-300.00;
gh1=0.002/z;
(****************)
{
a=0.0; b=k*h0-gh1; eps=0.000001;
t11=ffts(a,b,eps,f11);
a=k*h0-gh1; b=k*h0; eps=0.000001;
t12=ffts(a,b,eps,f12);
yn=t11+t12;
while ((xx2<=yn)&&(yn<=xx1))
z=e/(k*h0);
if(yn<xx2)
do {k=k+0.0001;}
while (xx2<=yn);
if(yn>xx1)
do {k=k-0.0001;}
while (yn<=xx1);
}
printf("z= %f\n","yn= %f\n",&z,&yn);
return 0;
}
#include "math.h"
double fftsf1(x,e,z)
{
double y;
y=f11(x,e,z);
return y;
}
double fftsf2(x,e,z)
{
double y;
y=f12(x,e,z);
return(y);
}