Testing a quadratic equation
- by user1201587
I'm doing a code testing for a program that calculate the results for a quadratic equation
I need to have test data for the following situation, when a is not zero and d positive there is two possibilities which are in the code below, I need to find an example for the first satiation when Math.abs(b / a - 200.0) < 1.0e-4 , all the values that I have tried, excute the second one
caption= "Two roots";
if (Math.abs(b / a - 200.0) < 1.0e-4)
{
System.out.println("first one");
x1 = (-100.0 * (1.0 + Math.sqrt(1.0 - 1.0 / (10000.0 * a))));
x2 = (-100.0 * (1.0 - Math.sqrt(1.0 - 1.0 / (10000.0 * a))));
}
else
{
System.out.println("secrst one");
x1 = (-b - Math.sqrt(d)) / (2.0 * a);
x2 = (-b + Math.sqrt(d)) / (2.0 * a);
}
}
}