const float EPSINON = 0.000001; if ((x >= - EPSINON) && (x <= EPSINON)) { //... }
#include <stdio.h> int main(void) { float x; if(|x - 0.000001|<0.000001) printf("YES!\n"); else printf("NO!\n"); return 0; } //应该是这样吧?