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
Printable View
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
>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
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.
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.
try doubles
max for unsigned long long is 18446744073709551615... i hope you realise how large that number is... hehe...
what about signed long? How I initialize only positive longs?
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:
i need infinitely large integer
Simple, just declare it as unsigned.Quote:
How I initialize only positive longs?
unsigned long num;