function value = r8poly_value_horner ( d, c, x )

%*****************************************************************************80
%
%% r8poly_value_horner() evaluates a polynomial using Horner's method.
%
%  Discussion:
%
%    The power sum form of a polynomial is:
%
%      p(x) = c(0) + c(1) * x + ... + c(n-1) * x^(n-1) + c(n) * x^(n)
%
%    Because MATLAB doesn't allow 0 indexing, we use an adjusted formula:
%
%      p(x) = c(1) + c(2) * x + ... + c(n) * x^(n-1) + c(n+1) * x^(n)
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    02 January 2015
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer D: the degree.
%
%    real C(D+1): the polynomial coefficients.  
%
%    real X: the evaluation point.
%
%  Output:
%
%    real VALUE: the polynomial value.
%
  value = c(d+1);
  for i = d : -1 : 1
    value = value * x + c(i);
  end

  return
end
