
      subroutine mkdifs(pert,cntr,n,iperc,spval)
c
c Find differences: pert = pert - cntr
c If iperc(ip)=1, find percent diffs, otherwise find raw diffs
c If either pert(i) or cntr(i) = spval (e.g., from ht interp), 
c   then return spval in pert(i)
c
      dimension pert(n),cntr(n)
c
      do i = 1,n
        if (iperc.gt.0) then
          if (cntr(i).le.1.e-20.or.
     +       (cntr(i).eq.spval.or.pert(i).eq.spval)) then
            pert(i) = spval
          else
            pert(i) = (pert(i) - cntr(i)) / cntr(i) * 100.
          endif 
        else
          if (pert(i).ne.spval.and.cntr(i).ne.spval) then
            pert(i) = pert(i) - cntr(i)
          else
            pert(i) = spval
          endif
        endif
      enddo
      return
      end
