一个三出口函数很地解决精度的问题。 int dblcmp(double d) { if(fabs(s)<给定的精度)//满足精度要求 return 0; return (d>0)?1:-1;//对于给定的精度的左右偏离方向。。 }