const float CHAZHI = 0.0000001; float a = ...; float b = ...; float d = a - b; if( d > CHAZHI) { printf("a > b"); } else if( d < -CHAZHI) { printf("a < b"); } else if(d <= fabs(CHAZHI)) { printf("a = b"); }
参考资料
http://blog.csdn.net/tjlakewalker/article/details/6836735
时间: 2024-12-21 01:57:56