主题:调用非线性程序hybrd的奇怪问题
用ifort编译时发现总是在fdjac1子程序的下面一段出现Program received signal SIGFPE的错误:
do 20 j = 1, n
temp = x(j)
* h = eps*dabs(temp)
if (h .eq. zero) h = eps
x(j) = temp + h
call fcn(n,x,wa1,iflag)
if (iflag .lt. 0) go to 30
x(j) = temp
do 10 i = 1, n
fjac(i,j) = (wa1(i) - fvec(i))/h
10 continue
20 continue
30 continue
go to 110
40 continue
标*的这句是出问题的地方,用idb调试显示各变量的值为:
j = 3 temp = 0 x(3) = 1.748524531767242e-311 eps = 1.4901161193880158e-08
这里x(3)实际已经下溢了,是否这造成了*那句的错误?请大家帮忙分析。感觉这里应该加一个下溢检查。
do 20 j = 1, n
temp = x(j)
* h = eps*dabs(temp)
if (h .eq. zero) h = eps
x(j) = temp + h
call fcn(n,x,wa1,iflag)
if (iflag .lt. 0) go to 30
x(j) = temp
do 10 i = 1, n
fjac(i,j) = (wa1(i) - fvec(i))/h
10 continue
20 continue
30 continue
go to 110
40 continue
标*的这句是出问题的地方,用idb调试显示各变量的值为:
j = 3 temp = 0 x(3) = 1.748524531767242e-311 eps = 1.4901161193880158e-08
这里x(3)实际已经下溢了,是否这造成了*那句的错误?请大家帮忙分析。感觉这里应该加一个下溢检查。