function value = year_is_leap_common ( y )

%*****************************************************************************80
%
%% year_is_leap_common() returns true if the Common year was a leap year.
%
%  Discussion:
%
%    The "common" calendar is meant to be the calendar which is Julian up to
%    day JED = 2299160, and Gregorian from day JED = 2299161 and after.
%
%  Algorithm:
%
%    If ( the year is less than 0 ) then
%
%      if the year+1 is divisible by 4 then
%        the year is a leap year.
%
%    else if ( the year is 0 ) then
%
%      the year is not a leap year ( in fact, it's illegal )
%
%    else if ( the year is no greater than 1582 ) then
%
%      if the year is divisible by 4 then
%        the year is a leap year.
%
%    else if (
%      the year is divisible by 4 and
%      ( the year is not divisible by 100
%      or
%      the year is divisible by 400 )
%      ) then
%        the year is a leap year.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    15 June 2012
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer Y, the year.
%
%  Output:
%
%    logical VALUE: true if the year was a leap year.
%
  if ( y == 0 )
    fprintf ( 1, '\n' );
    fprintf ( 1, 'YEAR_IS_LEAP_COMMON - Fatal error!\n' );
    fprintf ( 1, '  Year 0 is illegal.\n' );
    error ( 'YEAR_IS_LEAP_COMMON - Fatal error!' )
  end
%
%  BC years have to have 1 added to them to make a proper leap year evaluation.
%
  y2 = y_common_to_astronomical ( y );

  if ( y2 <= 1582 )

    if ( i4_modp ( y2, 4 ) == 0 )
      value = true;
    else
      value = false;
    end

  else

    if ( i4_modp ( y2, 400 ) == 0 )
      value = true;
    elseif ( i4_modp ( y2, 100 ) == 0 )
      value = false;
    elseif ( i4_modp ( y2, 4 ) == 0 )
      value = true;
    else
      value = false;
    end

  end

  return
end
