Android - Simplifying Radicals
<p>I am trying to make a calculator that performs the quadratic formula. </p>

<p>Currently if my result would be a decimal it returns NaN. (EDIT: Resolved)</p>

<p>Preferably I would like the result to be in an simplified radical form (i.e. √(99) = 3√(11) ).</p>

<p>How would I go about achieving this?</p>

<p>This is what I have so far.</p>

<pre><code>// Do the math
private double mathCalcPlus(double varA,double varB,double varC) {
    return ((-varB + Math.sqrt(varB * varB - 4 * varA * varC)) / 2 * varA);

}

private double mathCalcMinus(double varA,double varB,double varC) {
    return ((-varB - Math.sqrt(varB * varB - 4 * varA * varC)) / 2 * varA);

}
</code></pre>

<p>Any help will be greatly appreciated.</p>
