I don't know what is "large variable", forget "infinitely large variable". Any computer is a finite-state machine. Does it tell you something? It computing, there is a concept of "infinity", but it's an abstraction, more exactly, a number of abstractions.
Also, the size of data is not the same as size of a variable.
Now, you should see the big difference between two related concepts. One thing is "very large number". Such numbers can be represented using floating-point number
. First thing to understand is: representation of a really big number can carry pretty little amount of information. Isn't it a big number: 999999999
? :-) But it carries very modest amount of information. See also:
Floating point — Wikipedia, the free encyclopedia
IEEE floating point — Wikipedia, the free encyclopedia
Another thing is the number holding big volume of information, ideally, of the arbitrary size limited only by available computer memory. For simplicity, let's set aside such complicated thing as representation of arbitrary-size real numbers
. Let's consider arbitrary integer number, represented precisely, without any approximation. Apparently, such numbers can be represented as a sequence of bits of arbitrary size, limited only by available memory. The usual name for such types is "big integer", or, for a type name,
. Some of such types are really of unlimited size, but in C++ it's more usual to develop much weaker type where the maximum size is limited at the moment of object initialization.
The development of such classes is not even extremely difficult. Basically, you just mimic the operations learned in elementary schools arithmetic. Only I would not advice using strings to represent the sequence of 0..9 digits; such representation is utterly inefficient. It should be sequence of bits. You can do your search and find a number of available implementations (of different quality :-)).