public static int solveQuadratic(double[] eqn, double[] res)
public static int solveQuadratic(double[] eqn)
  public static int solveQuadratic(double[] eqn, double[] res)  {    // Taken from poly/solve_quadratic.c in the GNU Scientific Library    // (GSL), cvs revision 1.7 of 2003-07-26. For the original source,    // see http://www.gnu.org/software/gsl/    //    // Brian Gough, the author of that code, has granted the    // permission to use it in GNU Classpath under the GNU Classpath    // license, and has assigned the copyright to the Free Software    // Foundation.    //    // The Java implementation is very similar to the GSL code, but    // not a strict one-to-one copy. For example, GSL would sort the    // result.    double a;    double b;    double c;    double disc;    c = eqn[0];    b = eqn[1];    a = eqn[2];    // Check for linear or constant functions. This is not done by the    // GNU Scientific Library.  Without this special check, we    // wouldn't return -1 for constant functions, and 2 instead of 1    // for linear functions.    if (a == 0)    {			if (b == 0)				return -1;      			res[0] = -c / b;			return 1;		}    disc = b * b - 4 * a * c;    if (disc < 0)			return 0;    if (disc == 0)    {      // The GNU Scientific Library returns two identical results here.      // We just return one.	res[0] = -0.5 * b / a;      return 1;			}    // disc > 0    if (b == 0)    {      double r;      r = Math.abs(0.5 * Math.sqrt(disc) / a);      res[0] = -r;      res[1] = r;    }    else    {	double sgnb;	double temp;            sgnb = (b > 0 ? 1 : -1);      temp = -0.5 * (b + sgnb * Math.sqrt(disc));      // The GNU Scientific Library sorts the result here. We don't.      res[0] = temp / a;      res[1] = c / temp;		}    return 2;	}