Iconoclast
New member
http://www.swfcabin.com/open/1243708772
This would be a third major revision I have done.
What does anyone think? Did I screw this up to Hell?
The new algorithm is:
This would be a third major revision I have done.
What does anyone think? Did I screw this up to Hell?
The new algorithm is:
Code:
if (a == 0)
{
}
else if (c == 0)
{
if (b == 0)
{
x = 0;
}
else
{
x = 0 + ", " + -b / a;
}
}
else if (b == 0)
{
if (c / a < 0)
{
x = "+/-" + Math.sqrt(-c / a);
}
else if (c / a > 0)
{
x = "+/-" + Math.sqrt(+c / a) + "i";
}
}
else
{
if (b == 4 * a * c / b)
{
x = -b / (2 * a);
}
else if (b < 4 * a * c / b)
{
x = -b / (2 * a) + " +/- " + Math.sqrt(4 * a * c - b * b) / (2 * a) + "i";
}
else if (b > 4 * a * c / b)
{
x = (-Math.sqrt(b * b - 4 * a * c) - b) / (2 * a) + ", " + (Math.sqrt(b * b - 4 * a * c) - b) / (2 * a);
}
}