anchor.diff:      ! Function prototypes.
       interface
           ! The objective function f(x,n).
  -        double precision function f(x, n)
  -            double precision, intent(in)     :: x(:)
  +        real(kind(1.d0)) function f(x, n)
  +            real(kind(1.d0)), intent(in)     :: x(:)
               integer, intent(inout), optional :: n
           end function f
   
           ! The helper function best_nearby(...).
  -        double precision function best_nearby(delta, point, prevbest, nvars)
  -            double precision, intent(inout) :: delta(:)
  -            double precision, intent(inout) :: point(:)
  -            double precision, intent(in)    :: prevbest
  +        real(kind(1.d0)) function best_nearby(delta, point, prevbest, nvars)
  +            real(kind(1.d0)), intent(inout) :: delta(:)
  +            real(kind(1.d0)), intent(inout) :: point(:)
  +            real(kind(1.d0)), intent(in)    :: prevbest
               integer, intent(in)             :: nvars
           end function best_nearby
   
           ! The main optimization function hooke(...).
           integer function hooke(nvars, startpt, endpt, rho, epsilon, itermax)
               integer, intent(in)           :: nvars
  -            double precision, intent(in)  :: startpt(:)
  -            double precision, intent(out) :: endpt(:)
  -            double precision, intent(in)  :: rho
  -            double precision, intent(in)  :: epsilon
  +            real(kind(1.d0)), intent(in)  :: startpt(:)
  +            real(kind(1.d0)), intent(out) :: endpt(:)
  +            real(kind(1.d0)), intent(in)  :: rho
  +            real(kind(1.d0)), intent(in)  :: epsilon
               integer, intent(in)           :: itermax
           end function hooke
       end interface
   end module proto__
   
   ! === The user-supplied objective function f(x,n).
  -double precision function f(x, n)
  -    use proto__, only: funevals
  +real(DP) function f(x, n)
  +    use proto__, only: DP, funevals
   
       implicit none
   
       ! Returns: The objective function value.
   
       ! Arg. The point at which f(x) should be evaluated.
  -    double precision, intent(in) :: x(:)
  +    real(DP), intent(in) :: x(:)
   
       ! Arg. The number of coordinates of x.
       integer, intent(inout), optional :: n
   
   #ifndef WOODS
   ! Rosenbrock's classic parabolic valley ("banana") function.
  -    double precision :: a
  -    double precision :: b
  -    double precision :: c
  +    real(DP) :: a
  +    real(DP) :: b
  +    real(DP) :: c
   
       funevals = funevals + 1
   
  
positive.code: 
  ! === Helper function.
  ! Given a point, look for a better one nearby, one coord at a time.
  double precision function best_nearby(delta, point, prevbest, nvars)
      use proto__, only: VARS, f
  
      implicit none
  
      ! Returns: The objective function value at a nearby.
  
      ! Arg. The delta between prevbest and point.
      double precision, intent(inout) :: delta(:)
  
      ! Arg. The coordinate from where to begin.
      double precision, intent(inout) :: point(:)
  
      ! Arg. The previous best-valued coordinate.
      double precision, intent(in) :: prevbest
  
      ! Arg. The number of variables.
      integer, intent(in) :: nvars
  
      double precision :: minf
      double precision :: z(VARS)
      double precision :: ftmp
  
      integer :: i
  
  
negative.code: ! === Main optimization function.
  ! The hooke subroutine itself.
  integer function hooke(nvars, startpt, endpt, rho, epsilon, itermax)
      use proto__, only: DP, VARS, funevals, f, best_nearby
  
      implicit none
  
  