int main(int argc, char* argv[]) { float f1 = 0.0001f; // 精确范围 if (f2 >= -f1 && f2 <= f1) { // f1 等于 0 } return 0; }
vagrant@ubuntu2404:~/C++反汇编与逆向分析技术揭秘2/src/02/2-1$ g++ 2_1.cpp 2_1.cpp: In function ‘int main(int, char**)’: 2_1.cpp:5:7: error: ‘f2’ was not declared in this scope; did you mean ‘f1’? 5 | if (f2 >= -f1 && f2 <= f1) { | ^~ | f1