//float.cpp //floating point in boolean expressions #include #include //needed for fabbs function using namespace std; int main() { float x; float y; x = 1.0/3.0; y = 1.0; if (3.0*x == y) //false! cout << "first if\n"; if (fabs( 3.0*x - y) < 0.00001) //true cout << "second if\n"; system("pause"); return 0; }