function r8_to_dec_test ( )

%*****************************************************************************80
%
%% r8_to_dec_test() tests r8_to_dec().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    10 June 2015
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'r8_to_dec_test():\n' );
  fprintf ( 1, '  r8_to_dec() converts a real number to a decimal;\n' );

  dec_digit = 5;

  fprintf ( 1, '\n' );
  fprintf ( 1, '  The number of decimal digits is %d\n', dec_digit );

  fprintf ( 1, '\n' );
  fprintf ( 1, '     R   =>  A * 10^B  =>  R2\n' );
  fprintf ( 1, '\n' );

  for i = 1 : 10
    r = - 10.0 + 20.0 * rand ( 1, 1 );
    [ a, b ] = r8_to_dec ( r, dec_digit );
    r2 = dec_to_r8 ( a, b );
    fprintf ( 1, '  %8f  %6d  %6d  %10f\n', r, a, b, r2 );
  end

  return
end
