can any one tell me how i can store
2^99999
in integer variable..........
can any one tell me how i can store
2^99999
in integer variable..........
The standard C integer types can't do it directly (They max out around 2^64, at best). You could use them to store the exponent, or something like that. The double type (I think) is capable of doing it - but it won't treat it as an integer and you're already getting close to the limits.
You might be interested in a library like GMP. You need to work through function calls instead of operators, but it allows you to work with integers with practically limitless precision. It's extremely fast considering what it does, and is portable. http://www.gmplib.org
Depends on what you mean by an "integer variable", and what you plan to use it for.
My homepage
Advice: Take only as directed - If symptoms persist, please see your debugger
Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"
I agree with iMalc though: it depends on what you are trying to do with it. It may suffice to use a single bit to store the number (e.g., you are trying to represent a choice between 0 and 2^99999), or perhaps an int or long to store 99999 (e.g., you are working with powers of two only, so you just keep track of the exponent in order to store the number).
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
That, and if all you want to do is read in two long strings of digits and print the result of their addition (for example) then the ideal method is quite different to if you need to do all sorts of things such as multiplication, division, or square root on the large numbers etc.
My homepage
Advice: Take only as directed - If symptoms persist, please see your debugger
Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"