function r = quadratic_roots_real ( a, b, c )

%% QUADRATIC_ROOTS_REAL returns real roots of a quadratic polynomial.
%
%  A, B, C are the coefficients of the polynomial.
%
%  R is a vector of 0, 1 or 2 elements, depending on whether the polynomial
%  has 0, 1 or 2 real roots.
%
  d = b^2 - 4.0 * a * c;

  if ( d < 0.0 )
    r = [];
  elseif ( d == 0.0 )
    r = - b / ( 2.0 * a );
  else
    r = [ ( - b + sqrt ( d ) ) / ( 2.0 * a ), ...
          ( - b - sqrt ( d ) ) / ( 2.0 * a ) ];
  end

  return
end

