Problem with Long64_t

Dear Root users,

I try to define a Long64_t like:

Long64_t toto=4000000000; // 4e+09 cout << "toto= " << toto << endl;
but the display of this program gives me:

root [0] .X toto= -294967296
:open_mouth: It looks like an overflow, doesn’t it?
I can’t understand this result, I thought a Long64_t variable could increase up to 2^63 (or 2^63 -1).

If I make something like:

Long64_t papa=0; do { papa+=100000; cout << papa << endl; } while (papa>=0);
then “papa” goes up more than 10^12 (I stopped the program before it ended). This proves that I can use Long64_t type well. So, why “toto” can’t be 4e9?

If anyone has a comment or a response, thanks very much.

PS: I’m working with root 4.02/00 on Mac OS 10.3.9.

I add some informations:

I try also to do:

Long64_t toto=4000000000L; cout << toto << endl;
It doesn’t work yet.

16:46 $ uname -a Darwin 7.9.0 Darwin Kernel Version 7.9.0: Wed Mar 30 20:11:17 PST 2005; root:xnu/xnu-517.12.7.obj~1/RELEASE_PPC Power Macintosh powerpc 16:46 $ g++ -v Reading specs from /usr/libexec/gcc/darwin/ppc/3.3/specs Thread model: posix gcc version 3.3 20030304 (Apple Computer, Inc. build 1666)

Hi Aurelien,

Just try :

Long64_t toto=4000000000LL; // one L more cout << toto << endl;


:blush: Sorry, I never replied, but I just want to thank you, it works perfectly now. =D> \:D/