It's a simple code snipet like below: #include <iostream> using namespace std;
int main(){ double a; double b; cin >> a; cin >> b; double guess; cin >> guess; cout << (guess==(double)(a/b)) << endl; } and if you enter the data like this way: 8 10 0.8 This way, a, b and guess will be assigned as 8, 10, 0.8. So (guess==(double)(a/b)) should reutrn 1(true). but it doesn't. The result of this code will be "0". BTW, if you try to debug it in GDB, and try to "print (guess==(double)(a/b))". It will return true. You can see that GDB has the different answer to G++. -- Summary: Float Calucation bug? Product: gcc Version: 3.2.3 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: dinocho at mail2000 dot com dot tw CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19264