We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I do not see the right answer when i use this function.
float comppoly(x) { float y1,y2; float a1=0.1,b1=0.3,a2=2.1,b2=5.3,c=0.22; y1=a1*x+b1; y2=a1*x^2+b2*x+c; return(y2>y1);};
?can you say what is wrong?
float comppoly(float x) { float y1, y2; float a1=0.1, b1=0.3, a2=2.1, b2=5.3, c=0.22; y1 = (a1 * x) + b1; y2 = (a1 * x^2) + (b2 * x) + c; return(y2 > y1); }
Hah. Now it won't even compile (on a sane compiler). Not exactly a big improvement, is it?
:->
x^2 is a bit problematic when x is a float.
But then again - it is a bit problematic when x is an int too...