title: Quadratic Formula in Java for Android, can't spot my mistake
body: <p>I'm currently making an app for finding the roots of polynomials for android. At the moment I'm just dealing with quadratics however I can't spot my error. Whatever I've done it means my value for the root (only doing the first root right now), is always 0.0. Earlier I was trying to find my value for the discriminant and I kept getting the square of the 'b term' in the quadratic. My quadratic equation looks strange because of the way the application is set out, ever letter is shifted 1, so the closed form solution for quadratics in my app is -(c(+/-)(c^c-4*b*d)^(1/2))/(2*b). I would be grateful for any help, thanks! :)
  P.S. Please try to ignore my awful code, I'm just trying to get it working at the moment :)</p>
  
  <pre><code>public void onButtonClick(View v)
  {
  double rx, ry, rz, disc, disc2, a, b, c, d;
  String sa, sb, sc, sd, sx, sy, sz;
  EditText ta = (EditText)findViewById(R.id.a_c);
  EditText tb = (EditText)findViewById(R.id.b_c);
  EditText tc = (EditText)findViewById(R.id.c_c);
  EditText td = (EditText)findViewById(R.id.d_c);
  EditText tx = (EditText)findViewById(R.id.x);
  EditText ty = (EditText)findViewById(R.id.y);
  EditText tz = (EditText)findViewById(R.id.z);
  sa = ta.getText().toString();
  sb = tb.getText().toString();
  sc = tc.getText().toString();
  sd = td.getText().toString();
  sx = tx.getText().toString();
  sy = ty.getText().toString();
  sz = tz.getText().toString();
  if(sa.matches("")) {a = 0;} else {a = Double.parseDouble(sa);}
  if(sb.matches("")) {b = 0;} else {b = Double.parseDouble(sb);}
  if(sc.matches("")) {c = 0;} else {c = Double.parseDouble(sc);}
  if(sd.matches("")) {d = 0;} else {d = Double.parseDouble(sa);}
  if(sx.matches("")) {rx = 0;} else {rx = Double.parseDouble(sx);}
  if(sy.matches("")) {ry = 0;} else {ry = Double.parseDouble(sy);}
  if(sz.matches("")) {rz = 0;} else {rz = Double.parseDouble(sz);}
  disc2 = c*c-4*b*d;
  if(a == 0) {rx = (-c+Math.sqrt(disc2))/(2*b); tx.setText(Double.toString(rx));}
  }
  </code></pre>