is there an infinitely large integer type?

• 08-10-2002
MKashlev
is there an infinitely large integer type?
Is there an infinitely large integer file. I am writing a program that processes large files, and I need to make an infinitewly large array. How do I do this?

thanks
• 08-10-2002
Prelude
>I need to make an infinitewly large array
You can't do this because of memory constraints.

>I am writing a program that processes large files
I doubt that you have to process the entire file in memory all at once. Read a block of the file and process it, then save that block to disk and read another. Lather, rinse, repeat until the file has been completely processed.

-Prelude
• 08-10-2002
MKashlev
your idea is fine, but i need infinitely large integer because I am calculating the total number of nonnumerical values in each column of data (a 100MB file), and then replace those nonnumerical values with numbers in the order of their sequence in the array.
• 08-10-2002
Aran
read it in in blocks, and use multiple integers. unsigned long long's work pretty good :)... the range has to be in the trillions at least.
• 08-10-2002
XSquared
try doubles
• 08-10-2002
ninebit
max for unsigned long long is 18446744073709551615... i hope you realise how large that number is... hehe...
• 08-10-2002
MKashlev
what about signed long? How I initialize only positive longs?
• 08-10-2002
Crimpy
Quote:

i need infinitely large integer
What you're talking about is arbitrary precision arithmetic. You define your own number using either linked lists or an array so that you can have a huge precision in your calculation or you can use enormous numbers. Like if you're using an array, you can have a portable number up to 32,767 digits. But I imagine that for your problem a double would work fine.
Quote:

How I initialize only positive longs?
Simple, just declare it as unsigned.

unsigned long num;