BigInt class

Does anyone have a portable BigInt class written in C++?

If you've got your own code I'll be sure to respect copyrights if any.

What is a BigInt class, Veltas?
Well, that would be a class that has been 'operator overloaded' to function like an int but instead can store almost arbitrarily sized integers, implemented using more than just the basic integers that the processor can process.

You seem to have a specific form in mind...
Yes, rather than something properly optimised I'm looking for good ol' portable source code, preferably not relying on any libraries (other than STL, of course).

So for example something that could store:
30847874857234853245872348571384734587314851734517340589176345871348572134857134
Last edited on
Check out TTMath, for instance.
Does anyone have a portable BigInt class written in C++?

Yes, boost: http://www.boost.org/doc/libs/release/libs/multiprecision/doc/html/index.html
L B wrote:
Check out TTMath, for instance.

How do I use that? Just #include appropriate headers? Or do I have to also compile CPP files that come with it?

Unfortunately I don't ever seem to use libraries.
It probably comes with installation instructions. Check if there's some file called INSTALL, README or anything of the sort.
It comes with examples. Though you should also check out Boost as Cubbi recommended - TTMath does BigNum but only with static sizes you determine at compile time.
Topic archived. No new replies allowed.