Hi, everybody:
The following code will get different result in gcc3.2.3 and
gcc3.4 (or higher, like gcc4.0 or gcc4.1.0).
Anybody can give me some idea? Thank you in advance.
--
Kind Regards,
Tao Ma
-----------------------------------------
class Integral {
typedef long long int int64;
typedef unsigned long long int ullong;
public:
static const double TWO_EXP63 = ((ullong)1 << 63);
};
#include <iostream>
#include <math.h>
using namespace std;
int main() {
typedef long long int int64;
typedef unsigned long long int ullong;
int64 num_4 = (int64)pow((double)2, (double)63);
int64 num_5 = (int64)Integral::TWO_EXP63;
cout << "gcc3.2.3 will get: 0x8000000000000000" << endl;
cout << "gcc4.1.0 will get: 0x7fffffffffffffff" << endl;
cout << hex << num_4 << endl;
cout << hex << num_5 << endl;
}