function r = digits_sexagesimal_to_r8 ( d, p )

%*****************************************************************************80
%
%% digits_sexagesimal_to_r8() evalulates an N digit sexagesimal digit number.
%
%  Discussion:
%
%    R = d(1) * 60^p + d(2) * 60^(p-1) + ... + d(n) * 60^(p+1-n).
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    22 June 2022
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer D(N): the sexagesimal digits.
%
%    integer P: the power of 60 multiplying the first digit.
%
%  Output:
%
%    real R: the value represented.
%
  power = 60.0^p;
  n = length ( d );
  r = 0.0;
  for i = 1 : n
    r = r + d(i) * power;
    power = power / 60.0;
  end

  return
end

