function value = r8_heaviside ( x )

%*****************************************************************************80
%
%% r8_heaviside() evaluates the Heaviside function.
%
%  Discussion:
%
%    The Heaviside function is 0 for x < 0, 1 for x > 0, and 1/2 for x = 0.
%
%    For some reason, Octave does not include the "heaviside()" function,
%    which is built into MATLAB.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    30 November 2018
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    real X, the argument.
%
%  Output:
%
%    real VALUE, the value.
%
  value = x;

  i = find ( x < 0.0 );
  j = find ( x == 0.0 );
  k = find ( x > 0.0 );

  value(i) = 0.0;
  value(j) = 0.5;
  value(k) = 1.0;
  
  return
end
