function value = r8_next ( r8 )

%*****************************************************************************80
%
%% R8_NEXT returns the "next" double precision real value.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    21 January 2019
%
%  Author:
%
%    John Burkardt
%
%  Parameters:
%
%    Input, real R8, the real value.
%
%    Output, R8_NEXT, the smallest real value that is larger 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
