Cut
December 6th, 2001, 10:33 PM
I'm running the following in VS 6.0 under Win2k.
When I execute the debug version everything works fine but in the release version there is bug.
-1/x generates the answer -19 ! (it should be 0)
-2/x works as it should.
Does anyone know what's going on?
#include <iostream>
using namespace std;
int main()
{
int x = 19;
cout << "x = " << x << "\n\n";
cout << "-1/x = " << -1/x << "\n";
cout << "-1/19 = " << -1/19 << "\n\n";
cout << "-2/x = " << -2/x << "\n";
cout << "-2/19 = " << -2/19 << "\n\n";
return 0;
}
/Cut
When I execute the debug version everything works fine but in the release version there is bug.
-1/x generates the answer -19 ! (it should be 0)
-2/x works as it should.
Does anyone know what's going on?
#include <iostream>
using namespace std;
int main()
{
int x = 19;
cout << "x = " << x << "\n\n";
cout << "-1/x = " << -1/x << "\n";
cout << "-1/19 = " << -1/19 << "\n\n";
cout << "-2/x = " << -2/x << "\n";
cout << "-2/19 = " << -2/19 << "\n\n";
return 0;
}
/Cut