
please wait
(-b - sqrt((long double) ((b^2) - (4 * (a * c))))) / (2 * a);
(-b - sqrt((float) ((b^2) - (4 * (a * c))))) / (2 * a);
(-b - sqrt((double) ((b^2) - (4 * (a * c))))) / (2 * a);
b*b
.qans2 = (-b - sqrt( pow(b,2) - (4 * (a * c)))) / (2 * a);
pow(b,2) - (4 * (a * c))
can be treated as type long double
OR type float
OR type double
. The compiler can't handle the ambiguity. It needs you to tell it how to treat the parameter.
|
|
float
(it would've been treated as an int
otherwise).float
for both calls to sqrt. I have given an example above (and in my previous post) on how to do this.