Hi,
I'm trying to work with 64-bit numbers.
I declared my variable as "long long": long long decimal_place;
then I assign it a value: decimal_place = 1000000000000; // The 1 exp 12 is the largest decimal place for a 40-bit number
but I get a compiler error: integer constant is too large for 'long' type.
Why?
After I get this resolved, I want to print the value to the screen.
How do I that?
Thanks,
Victor
operating and printing with 64-bit numbers
-
- Posts: 11
- Joined: Thu May 22, 2008 5:36 am
Re: operating and printing with 64-bit numbers
Try adding an 'L' after the constant you are trying to load into the long value as the compiler is trying to store it into an integer.
decimal_place = 1000000000000L;
decimal_place = 1000000000000L;
Re: operating and printing with 64-bit numbers
I don't think that a single "L" will work since that is only 32 bits (also the size of int on 32-bit architectures).
To tell the compiler that your constant is 64 bits, you need to append two "L"s like so:
long long i = 5000000000LL;
To tell the compiler that your constant is 64 bits, you need to append two "L"s like so:
long long i = 5000000000LL;