anchor.diff:          end do !do jj=1,niter
   
           ! pay attention to overflow
  -        if( slos.gt.tlen ) then
  -          slos=slos-tlen
  +        if( slos.gt.dcum(iu) ) then
  +          slos=slos-dcum(iu)
           end if
   
         else !if(lback)
  
positive.code: ! . iNew is iApeUp
    lApeUp=iApeUp.eq.iNew.and.ixApeUp.eq.ixNew
  
  ! . iNew is at the same s as iApeUp (inlcuding ring overvlow)
    lAupDcum=abs(dcum(iNew)-dcum(iApeUp)).lt.sPrec.or.abs(dcum(iNew)-dcum(iApeUp)-tlen).lt.sPrec
  
  ! . iNew is iApeDw
    lApeDw=iApeDw.eq.iNew.and.ixApeDw.eq.ixNew
  
  ! . iNew is at the same s as ApeDw (inlcuding ring overvlow)
    lAdwDcum=abs(dcum(iNew)-dcum(iApeDw)).lt.sPrec.or.abs(dcum(iNew)-dcum(iApeDw)-tlen).lt.sPrec
  
  ! . constant aperture?
    lconst = sameAperture( ixApeUp, ixApeDw )
  
negative.code: 
       ! actual interpolation
       ddcum = spos-dcum(iUp)
       if( ddcum.lt.zero ) ddcum=dcum(iu)+ddcum
       mdcum = dcum(iDw)-dcum(iUp)
       if( mdcum.lt.zero ) mdcum=dcum(iu)+mdcum
       do jj=1,9
          oApe(jj)=((ape(jj,ixDw)-ape(jj,ixUp))/mdcum)*ddcum+ape(jj,ixUp)
       end do
  