anchor.diff:          
           INTEGER(ip), PARAMETER:: ninterp_points = 601
           LOGICAL, PARAMETER:: log_transform_interpolation = .FALSE.
  -        REAL(dp):: kj_xs(ninterp_points), kj_ys(ninterp_points)
  +        REAL(dp):: kj_xs(ninterp_points), kj_ys(ninterp_points), precomputed_gradient(ninterp_points - 1)
   
           ! Make the kajiura_G_interpolator
           DO i = 1, ninterp_points
  
positive.code:     ! We want to find the index corresponding to the value in 'x' that is nearest y.
      ! This is a useful operation e.g. for interpolation of sorted input data
      !
      SUBROUTINE nearest_index_sorted(n, x, y, output)
          INTEGER(ip), INTENT(IN) :: n
          REAL(dp), INTENT(IN) :: x(n)
          REAL(dp), INTENT(IN) :: y      
  
negative.code:             ! interpolate
              if (input_x(j) > output_x(i)) then
                  if(j > 1) then
                      !if(present(precomputed_gradient)) then
                          gradient = precomputed_gradient(j-1)
                      !else
                      !    gradient = (input_y(j) - input_y(j-1))/(input_x(j) - input_x(j-1))
                      !end if
                          
                      output_y(i) = input_y(j-1) +  gradient * (output_x(i) - input_x(j-1))
                  else
                      output_y(i) = input_y(1)
                  end if
              else
                  if(j < n_input) then
                      !if(present(precomputed_gradient)) then
                          gradient = precomputed_gradient(j)
                      !else
                      !    gradient = (input_y(j+1) - input_y(j))/(input_x(j+1) - input_x(j))
                      !end if
                      output_y(i) = input_y(j) +  gradient * (output_x(i) - input_x(j))
                  else
                      output_y(i) = input_y(n_input)
  