large numbers, c++ ?

Hi, I have numbers up to order e100 (i.e. 10^100). How can I store them in c++?


Thanks! :)

hansaaa :)
Long long, double , long double
nope, long long only supports


–9,223,372,036,854,775,808 to 9,223,372,036,854,775,807.

long double supports^, according to http://msdn.microsoft.com/en-us/library/s3f49ktz(v=vs.80).aspx,

1.7E +/- 308, which, according to http://msdn.microsoft.com/en-us/library/s3f49ktz(v=vs.80).aspx, are 15 digits, but, I don't see how, because 1.7E308 should be 308 digits...

in the end, though, on my machine, neither long long, nor double or long double support the numbers I am trying to use.

e.g.

1
2
3
4
5
6
7
8
9
long long l;
l = 2000*2000*2000*2000*2000*2000*2000*2000*2000*2000*2000*2000;

double ll;
ll = 2000*2000*2000*2000*2000*2000*2000*2000*2000*2000*2000*2000;

long double lll;
lll = 2000*2000*2000*2000*2000*2000*2000*2000*2000*2000*2000*2000;


all give zero. :S


using
1
2
3
4
5
6
7
8
long long l;
l = 2000ll*2000ll*2000ll*2000ll*2000ll*2000ll*2000ll*2000ll*2000ll*2000ll*2000ll*2000ll;
double ll;
ll = 2000ll*2000ll*2000ll*2000ll*2000ll*2000ll*2000ll*2000ll*2000ll*2000ll*2000ll*2000ll;

long double lll;
lll = 2000ll*2000ll*2000ll*2000ll*2000ll*2000ll*2000ll*2000ll*2000ll*2000ll*2000ll*2000ll;


doesn't work either, it gives some number

-5.048253707305615360e+018
Last edited on
aha, 2.0e3 works! Thanks!!
Topic archived. No new replies allowed.