Long long int not holding my value

So I need to store a large (trillion) number and am trying to use unsigned long long int.

But when trying to store it, it says that "error: integer constant is too large for "long" type".

Using ULONG_LONG_MAX= 18446744073709551615 which is much larger than my number.

What is happening here?
Please give us the code that causes this error.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <iostream>
#include <cstdio>
#include <cmath>
#include <fstream>
#include <iomanip>
#include <ctime>
#include <sstream>
#include <math.h>
#include <cctype>

using namespace std;

int main()

{

       unsigned long long int a = 1000000000000;

}
Compiles without error on my 64-bit OS machine using LLVM (clang++ front end, V1.1) and g++ (V 4.4.3)
Compiling with mingw.

Is it because I have a 32 bit system?
@rozick1

Try defining your variable as unsigned _int64 a;. As long as the number is positive, it works.
What does this give you?

1
2
3
4
5
6
7
8
#include <limits>
#include <iostream>

int main()
{
 const long long int max_int = std::numeric_limits<long long int>::max();
 std::cout << max_int;
}

@whitenite1

Same error.
@Moschops

9223372036854775807
_int64 is non-standard and I'll be surprised if the MinGW gcc port recognises it.
It does but only with an extra underscore.
Topic archived. No new replies allowed.