#include <bits/stdc++.h>
using namespace std;
double a,b,c,d;
double getnum(double g){
double ans=double(a)*(g*g*g)+(double(b)*(g*g))+(double(c)*g)+double(d);
return ans;
}
int main(){
cin>>a>>b>>c>>d;
for(double i=-10000;i<=10000;i++){
double g=double(i)/double(100);
double t=0;
if(getnum(g)*getnum(g+0.01)<0&&getnum(g)*getnum(g+0.01)!=-0){
if(abs(getnum(g))>abs(getnum(g+0.01))){
t=g+0.01;
printf("%.2lf ",t);
}else{
t=g;
printf("%.2lf ",t);
}
}
if(getnum(g)*getnum(g-0.01)==0){
if(!getnum(g)){
t=g;
printf("%.2lf ",t);
}
}
}
return 0;
}
程序运行时有几个数据带入会计算出-0这个违背常理的结果,只得特判,请问各位大佬这是为什么?