function [ y, m, d, f, ierror ] = ymdf_check_republican ( y, m, d, f )

%*****************************************************************************80
%
%% YMDF_CHECK_REPUBLICAN checks a Republican YMDF date.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    22 April 2013
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer Y, M, D, real F, the YMDF date.
%
%  Output:
%
%    integer Y, M, D, real F, the YMDF date, which may be corrected.
%
%    integer IERROR, is 0 if the date is legal.
%
  ierror = 0;

  [ y, m, d, ierror ] = ymd_check_republican ( y, m, d );

  if ( ierror ~= 0 )
    return
  end

  [ y, m, d, f ] = frac_borrow_republican ( y, m, d, f );

  [ y, m, d, f ] = frac_carry_republican ( y, m, d, f );

  return
end
