anchor.diff:      end interface
   
       ! LOCAL SCALARS
  -    integer :: i, j, k, pos
  -    real(8) :: error, p, ff
  +    integer :: i, j, k, pos, pi, pj
  +    real(8) :: error, ff
   
       ! LOCAL ARRAYS
  -    real(8) :: l(n - 1), u(n - 1), ncorr((n - 2) * (n - 3) / 2)
  +    real(8) :: l(n - 1), u(n - 1), ncorr((n - 1) * (n - 2) / 2)
       integer :: infty(n - 1)
   
  +    flag = 0
  +
       do k = 1,n
   
          ff = fgauss(x(k), MU(k), 1.0D0)
   
  -       if ( ff .lt. 1.0D-60 ) then
  +       dp(k) = 0.0D0
  +
  +       if ( ff .gt. 1.0D-60 ) then
   
             pos = 1
   
             do j = 1, n
   
  -             if ( j .eq. k ) continue
  +             if ( j .eq. k ) cycle
   
                do i = 1, j - 1
   
  -                if ( i .eq. k ) continue
  +                if ( i .eq. k ) cycle
  +
  +                if ( i .lt. k ) then
  +
  +                   pi = i + (k - 1) * (k - 2) / 2
  +
  +                else
  +
  +                   pi = k + (i - 1) * (i - 2) / 2
  +
  +                end if
  +
  +                if ( j .lt. k ) then
  +
  +                   pj = j + (k - 1) * (k - 2) / 2
  +
  +                else
  +
  +                   pj = k + (j - 1) * (j - 2) / 2
  +
  +                end if
   
                   ncorr(pos) = corr(i + (j - 1) * (j - 2) / 2)
  +
  +                ncorr(pos) = ncorr(pos) - corr(pi) * corr(pj)
   
                   pos = pos + 1
   
  
positive.code:     real(8) :: ABSERR, p, RELERR
  
      ! ARRAY ARGUMENTS
      real(8) :: CORR((n - 1) * (n - 2) / 2), MU(n), x(n)
  
      intent(in ) :: ABSERR, CORR, MU, n, RELERR, x
      intent(out) :: p, flag
  
negative.code:     real(8) :: ABSERR, RELERR
  
      ! ARRAY ARGUMENTS
      real(8) :: CORR(n * (n - 1) / 2), dp(n), MU(n), x(n)
  
      intent(in ) :: ABSERR, CORR, MU, n, RELERR, x
      intent(out) :: dp, flag
  