Grotesquely large numbers in C

Chaotic42

Lifer
Jun 15, 2001
34,840
2,013
126
Yeah, fine, 32768.

Great.

4294967296?

Fine.

3.4028236692093846346337460743177e+38?

Yeah.

But how do I handle *big* numbers in C? Huge numbers?

Like (((((4.55e+999)^(4.55e+999))^(4.55e+999))^4.55e+9999999999999999999999999999999999999999999999999999999999999999999)?

I think I've got that closed off right. Anyway, you get my point.

Ideas?


 

Haircut

Platinum Member
Apr 23, 2000
2,248
0
0
If the numbers are as big as the one you posted then you won't be able to actually do anything with the numbers other than store them, even then you would have to store them in some sort of multiple power system as the one you have shown.

Computers simply do not have enough memory to manipulate numbers of that magnitude.

Even something as 'small' as (4.55e+8)^(4.55e+8) has over 2 billion digits and would require something like 800 Mb to store it in its full form.
 

Chaotic42

Lifer
Jun 15, 2001
34,840
2,013
126
Originally posted by: Haircut
If the numbers are as big as the one you posted then you won't be able to actually do anything with the numbers other than store them, even then you would have to store them in some sort of multiple power system as the one you have shown.

Computers simply do not have enough memory to manipulate numbers of that magnitude.

Even something as 'small' as (4.55e+8)^(4.55e+8) has over 2 billion digits and would require something like 800 Mb to store it in its full form.


;)

I know.

I've just run into a limit, and I'd like larger numbers. Not even as big as the one you posted.

 

Barnaby W. Füi

Elite Member
Aug 14, 2001
12,343
0
0
Originally posted by: Chaotic42
Originally posted by: BingBongWongFooey
Python :p

Python can handle arbitrarily large numbers? That's even better then.

Yep, python longs are totally unlimited in size. Use the syntax "12345L", or I think in 2.2 you might not even have to do that. NumPy may also be of some use to you (dunno what you're using it for)
 

BFG10K

Lifer
Aug 14, 2000
22,709
3,003
126
You can use arbitrarily long numbers if you implement your own class using strings and operator overloading to perform arithmetic on them. Then your only limit is memory.