Unsolved About a trouble with big numbers
-
Hi !
Everybody knows that 2 power 64 equals to 18446744073709551616 ...
I defined a variable:quint64 x = 1 << 63;
When I hover over x, VS2015 tells me: 18446744071562067968
We agree that x equals to 2 power 63. So what VS gives is wrong.
Could you help please ?
Thanks. -
remember that these are unsigned integers and constants are 32 bits by default and 1<<63 is 2^63 not 2^64 (easy to check that 1<<1 = 2^1 and 1<<2 = 2^2 and so on)
quint64 x = 1Ui64 << 63;
x == 9223372036854775808
-
Ok, I forgot that ! Thanks a lot