anchor.diff:    ! A.Mereghetti (CERN, 2018-03-01)
     ! a general module, collecting some utility functions
     use floatPrecision
  -
  -  logical :: ldebug=.true.
   
   contains
   
  
positive.code:     jMax=datalen
      if(present(rmax)) jMax=huntBin(rmax,xvals,datalen,-1)
  
      if (ldebug) write(lout,"(/a,5(1X,i0))") "UTILS> DEBUG polintegrate start: ",datalen,mpoints,order,jMin,jMax
  
      do jj=jMin+1,jMax ! loop over data points
         kMin=min(max(jj-1-(mpoints-1)/2,1),datalen+1-mpoints)
  
negative.code:     do ii=1, datalen-1
        if(xvals(ii) >= xvals(ii+1)) then
          checkArray=.false.
          if (llprint) then
            write(lerr,"(a)") "UTILS> ERROR checkArray: xvals should be in increasing order"
            write(lerr,"(a,i0)") "UTILS>       it is not the case at ii=",ii
          end if
        end if
      end do
    end function checkArray
  