function r8_roundx_test ( )

%*****************************************************************************80
%
%% r8_roundx_test() tests r8_roundx().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    19 April 2009
%
%  Author:
%
%    John Burkardt
%
  x = pi;

  fprintf ( 1, '\n' );
  fprintf ( 1, 'R8_ROUNDX_TEST\n' );
  fprintf ( 1, '  R8_ROUNDX rounds a number to a\n' );
  fprintf ( 1, '  specified number of decimal digits.\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Test effect on PI:\n' );
  fprintf ( 1, '  X = %f\n', x );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  NPLACE  XROUND\n' );
  fprintf ( 1, '\n' );

  for i = 0 : 10
    nplace = i;
    xround = r8_roundx ( nplace, x );
    fprintf ( 1, '  %6d  %f\n', i, xround );
  end

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Test effect on random values:\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  NPLACE  X     XROUND\n' );
  fprintf ( 1, '\n' );

  for i = 1 : 5

    x = rand ( 1, 1 );

    fprintf ( 1, '\n' );

    for nplace = 0 : 2 : 10
      xround = r8_roundx ( nplace, x );
      fprintf ( 1, '  %6d  %f  %f\n', nplace, x, xround );
    end

  end

  return
end
