public void solve(){
  if (a == 0.0 && b == 0.0)   values();
 else   if (a == 0.0 && b != 0.0)   values(linear(b,c));
 else   if (a != 0.0 && c == 0.0)   values(0.0,linear(a,b));
 else {
    double d=b * b - 4.0 * a * c;
    if (d < 0.0)     values();
 else     if (d == 0.0)     values(-b / (2.0 * a));
 else     values((-b + Math.sqrt(d)) / (2.0 * a),(-b - Math.sqrt(d)) / (2.0 * a));
  }
}

public void solve ( ) { if ( a == 0.0 && b == 0.0 ) values ( ) ; else if ( a == 0.0 && b != 0.0 ) values ( linear ( b , c ) ) ; else if ( a != 0.0 && c == 0.0 ) values ( 0.0 , linear ( a , b ) ) ; else { double d = b * b - 4.0 * a * c ; if ( d < 0.0 ) values ( ) ; else if ( d == 0.0 ) values ( - b / ( 2.0 * a ) ) ; else values ( ( - b + Math . sqrt ( d ) ) / ( 2.0 * a ) , ( - b - Math . sqrt ( d ) ) / ( 2.0 * a ) ) ; } }
solve a * x ^ 2 + b * x + c = 0 for x for real values of x . < p > see winston and horn , lisp p . 167 - 169 .
