src/dierckx.f90: detect overflow in fpgrre
When a call to regrid results in ier=-1 (data needs to be refitted with interpolating spline) the computation of the sum of the residuals can overflow. In this case we can exit immediately (avoiding raising a FPE) ignoring the results. The latter need to be recomputed anyway.
This commit is contained in:
parent
b0674c2d9b
commit
19f6d7f2f0
@ -1762,6 +1762,7 @@ contains
|
|||||||
subroutine fpgrre(ifsx,ifsy,ifbx,ifby,x,mx,y,my,z,mz,kx,ky,tx,nx, &
|
subroutine fpgrre(ifsx,ifsy,ifbx,ifby,x,mx,y,my,z,mz,kx,ky,tx,nx, &
|
||||||
ty,ny,p,c,nc,fp,fpx,fpy,mm,mynx,kx1,kx2,ky1,ky2,spx,spy,right,q, &
|
ty,ny,p,c,nc,fp,fpx,fpy,mm,mynx,kx1,kx2,ky1,ky2,spx,spy,right,q, &
|
||||||
ax,ay,bx,by,nrx,nry)
|
ax,ay,bx,by,nrx,nry)
|
||||||
|
use, intrinsic :: ieee_arithmetic, only : ieee_is_finite
|
||||||
! ..
|
! ..
|
||||||
! arguments
|
! arguments
|
||||||
integer, intent(in) :: kx, kx1, kx2, ky, ky1, ky2, mm, mx, my, mz, &
|
integer, intent(in) :: kx, kx1, kx2, ky, ky1, ky2, mm, mx, my, mz, &
|
||||||
@ -2087,6 +2088,7 @@ contains
|
|||||||
term = (z(iz)-term)**2
|
term = (z(iz)-term)**2
|
||||||
! adjust the different parameters.
|
! adjust the different parameters.
|
||||||
fp = fp+term
|
fp = fp+term
|
||||||
|
if (.not. ieee_is_finite(fp)) exit
|
||||||
fpx(numx1) = fpx(numx1)+term
|
fpx(numx1) = fpx(numx1)+term
|
||||||
fpy(numy1) = fpy(numy1)+term
|
fpy(numy1) = fpy(numy1)+term
|
||||||
fac = term*half
|
fac = term*half
|
||||||
|
Loading…
Reference in New Issue
Block a user