Hi,
I want to use the 64 bit integer type (long long or Long64_t) in my macro but I get funny results when I run it in ROOT or CINT. This is a code that demonstrates it:
//
unsigned long long func(){
unsigned long long m=4294967295ULL;
unsigned long long x=79ULL;
unsigned long long r=x%m;
return r;
}
void test(){
cout<<func()<<endl;
cout<<func()<<endl;
cout<<func()<<endl;
for(int i=0;i<3;i++){
cout<<func()<<endl;
}
}
//
The output is:
79
79
79
0
0
0
i. e. I get wrong result when I call the function func() from the for-loop.
When I use m=4294967296ULL which is 2^32, ROOT crashes with “floating point exception”. When I compile the code everything seems to be ok.
My system:
ROOT version 5.10/00
cint version 5.16.8
Linux version 2.6.12-1-686 (gcc version 4.0.2 20050917 (prerelease) (Debian 4.0.1-8 ))
I tried this on 2 more PCs with other ROOT versions. I get similar results with:
ROOT version 4.04/02, cint 5.15.169,
Linux version 2.4.25 (gcc version 2.95.3 20010315 (release))
BUT NOT with:
ROOT 4.03/02, cint 5.15.159
Linux version 2.4.29-z1 (gcc version 2.95.3 20010315 (release))
-here it seems to be o.k.
Do you think it is a CINT bug?
Cheers,
Juraj