I was wondering if there was any way to store very large variables? Larger than a Long would let you hold.
I was wondering if there was any way to store very large variables? Larger than a Long would let you hold.
I was thinking something more along the lines of an infinate variable.
hmm the best i can think of is to define a macro with the value..
but it will only store that number and connect be changed..Code:#define PI = 3.14blah blah
maybe some more expeirienced programmers know a better way.
Last edited by mrafcho001; 03-22-2005 at 04:47 PM.
Would you care to elaborate just a tad more? How large a number are you talking about?
Currently, the largest built-in types are commonly 64-bits, however there are lots of classes available in assorted places online that afford the use of arbitrary length integers (you'll find a lot fewer that support floating point numbers).
That #define statement should not have an equal sign and even if you hard-coded a numeric value, it would still be subject to the limits of the compiler.Originally Posted by mrafcho001
You can use an INT64 which is quite large.
If you need arbitrary prescicion then you could check out http://www.swox.com/gmp/
Although _int64 is freaking ENORMOUS, if you want to keep getting bigger and bigger, you and just convert a string of tons of numbers to an int, I suppose.
You might also consider using the BigInt class.
Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah
You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie
You reminded me of a class I wrote called HugeFloat. While it, a singleton effort, surely cannot hold a candle to GMP or any other collaboration, the code is simple and you might find it educational or interesting to mull over.
I just started a thread about it here. Let us know how things work out for you.