Anyone know where I can find a compact implementation of "big number", about 300 lines or less? with simple operations like add subtract mult. divide and power?
thanks a lot!
Anyone know where I can find a compact implementation of "big number", about 300 lines or less? with simple operations like add subtract mult. divide and power?
thanks a lot!
How much do you care about efficiency? If not for the compactness requirement, the GMP is probably a good idea.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
I wrote not one, but two of them and they're available on my website in the Useful Classes section.
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"
Did you ever fix those problems I told you about?
Soma
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've just dropped by to check my email and stuff. I'm about to hit the sack.)
At the time, you had relied on a few MSVC extensions related to template handling (e.g. not using `typename' to refer to an inherited type from a template).
If you want, or if you just don't have a different compiler available, I'll take a look at them tomorrow.
Soma
Oh that's right - portability.
I had a different compiler on my old PC that I used to use for increasing compatibility, but I haven't installed anything else on my new PC yet. I do remember taking care of much of it, so the bigint class should hopefully be fine, just probably not the varbigint class. My varbigint class uses an unnamed union iirc. I knew about the unportability of that when writing it, and yet somehow I just didn't particularly care.
I'll get back into looking at portability again shortly. I'm away for the rest of the weekend.
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 just sent you a PM or few. (It limits the number of characters.)
Okay. I'm an idiot. I sent visitor messages instead of private messages. >_<
Soma
Last edited by phantomotap; 03-12-2010 at 04:26 PM. Reason: >_<
thanks iMalc, your bigint class is exactly what I was looking for...