function value = r8_previous ( r8 )

%*****************************************************************************80
%
%% r8_previous() returns the "previous" double precision real value.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    21 January 2019
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    real R8, the real value.
%
%  Output:
%
%    real VALUE, the largest real value that is smaller than R8.
%
  if ( r8 == 0.0 )
    value = - realmin ( 'double' );
  elseif ( r8 == realmin ( 'double' ) )
    value = 0.0;
  elseif ( r8 == - realmax )
    value = - Inf;
  elseif ( r8 == - Inf )
    value = - Inf;
  elseif ( 0.0 < r8 )
    v = 1.0 - eps / 2.0;
    value = r8 * v;
  else
    v = 1.0 - eps / 2.0;
    value = r8 / v;
  end

  return
end

