Hi!
The following program compiled with gcc 3.3.3
#include <iostream> using namespace std;
int main() { double x = 0.55; int v1 = (int) (x * UINT_MAX); int v2 = (int) (0.55 * UINT_MAX);
cout << dec << v1 << "\t" << hex << v1 << endl; cout << dec << v2 << "\t" << hex << v2 << endl; }
produces the output:
-2147483648 80000000 -1932735284 8ccccccc
This is obviously a bug.
Changing "double x = 0.55;" to "const double x = 0.55;" produces expected results.
Christoph