function [ n_data, jed, rd ] = jed_rd_values ( n_data )

%*****************************************************************************80
%
%% jed_rd_values() returns the RD for Julian Ephemeris Dates.
%
%  Discussion:
%
%    The JED (Julian Ephemeris Date) is a calendrical system which counts days,
%    starting from noon on 1 January 4713 BCE.
%
%    The RD is the Reingold Dershowitz Date, which counts days from
%    midnight, 1 January year 1 in the Gregorian calendar.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    16 September 2004
%
%  Author:
%
%    John Burkardt
%
%  Reference:
%
%    Edward Reingold and Nachum Dershowitz,
%    Calendrical Calculations: The Millennium Edition,
%    Cambridge University Press, 2001,
%    ISBN: 0 521 77752 6
%
%  Input:
%
%    integer N_DATA.  The user sets N_DATA to 0 before the first call.
%
%  Output:
%
%    integer N_DATA.  On each call, the routine increments N_DATA by 1, and
%    returns the corresponding data; when there is no more data, the
%    output value of N_DATA will be 0 again.
%
%    real JED, the Julian Ephemeris Date.
%
%    real RD, the Reingold Dershowitz Date.
%
  n_max = 33;

  jed_vec = [ ...
    1507231.5E+00, ...
    1660037.5E+00, ...
    1746893.5E+00, ...
    1770641.5E+00, ...
    1892731.5E+00, ...
    1931579.5E+00, ...
    1974851.5E+00, ...
    2091164.5E+00, ...
    2121509.5E+00, ...
    2155779.5E+00, ...
    2174029.5E+00, ...
    2191584.5E+00, ...
    2195261.5E+00, ...
    2229274.5E+00, ...
    2245580.5E+00, ...
    2266100.5E+00, ...
    2288542.5E+00, ...
    2290901.5E+00, ...
    2323140.5E+00, ...
    2334848.5E+00, ...
    2348020.5E+00, ...
    2366978.5E+00, ...
    2385648.5E+00, ...
    2392825.5E+00, ...
    2416223.5E+00, ...
    2425848.5E+00, ...
    2430266.5E+00, ...
    2430833.5E+00, ...
    2431004.5E+00, ...
    2448698.5E+00, ...
    2450138.5E+00, ...
    2465737.5E+00, ...
    2486076.5E+00 ];

  rd_vec = [ ...
    -214193.0E+00, ...
     -61387.0E+00, ...
      25469.0E+00, ...
      49217.0E+00, ...
     171307.0E+00, ...
     210155.0E+00, ...
     253427.0E+00, ...
     369740.0E+00, ...
     400085.0E+00, ...
     434355.0E+00, ...
     452605.0E+00, ...
     470160.0E+00, ...
     473837.0E+00, ...
     507850.0E+00, ...
     524156.0E+00, ...
     544676.0E+00, ...
     567118.0E+00, ...
     569477.0E+00, ...
     601716.0E+00, ...
     613424.0E+00, ...
     626596.0E+00, ...
     645554.0E+00, ...
     664224.0E+00, ...
     671401.0E+00, ...
     694799.0E+00, ...
     704424.0E+00, ...
     708842.0E+00, ...
     709409.0E+00, ...
     709580.0E+00, ...
     727274.0E+00, ...
     728714.0E+00, ...
     744313.0E+00, ...
     764652.0E+00 ];

  if ( n_data < 0 )
    n_data = 0;
  end

  n_data = n_data + 1;

  if ( n_max < n_data )
    n_data = 0;
    jed = 0.0;
    rd = 0.0;
  else
    jed = jed_vec(n_data);
    rd = rd_vec(n_data);
  end

  return
end
