function euler_mascheroni_test ( )

%*****************************************************************************80
%
%% euler_mascheroni_test() tests euler_mascheroni().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    21 May 2022
%
%  Author:
%
%    John Burkardt
%
  g = euler_mascheroni ( );

  fprintf ( 1, '\n' );
  fprintf ( 1, 'euler_mascheroni_test():\n' );
  fprintf ( 1, '  euler_mascheroni() returns the Euler-Mascheroni constant\n' );
  fprintf ( 1, '  sometimes denoted by "gamma".\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  gamma = limit ( N -> oo ) ( sum ( 1 <= I <= N ) 1 / I ) - log ( N )\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Numerically, g = %24.16g\n', g );
  fprintf ( 1, '\n' );
  fprintf ( 1, '         N      Partial Sum    |gamma - partial sum| \n' );
  fprintf ( 1, '\n' );

  n = 1;
  for test = 0 : 20
    g_approx = - log ( n );    
    for i = 1 : n
      g_approx = g_approx + 1.0 / i;
    end
    fprintf ( 1, '  %8d  %14.6g  %14.6g\n', n, g_approx, abs ( g_approx - g ) );
    n = n * 2;
  end

  return
end
