Representing Huge Numbers

Started by
1 comment, last by Bregma 17 years, 5 months ago
I thought I'd take a crack at implementing a math system that can deal with (very simple) equations and solve for unknowns. While I was thinking of ways this may be accomplished, I began to wonder... just how can I deal with really huge numbers? What if I need to store a number with 1000 digits, for example? How is this done? I know it can be done; I've seen plenty of software do it before. Is there a way to create a C++ class to represent such an enourmous value? Also, would it be possible to use templates to indicate the type of the huge number? (So HugeNumber<Decimal> would store huge floating point values and HugeNumber<Integer> would store huge integer values.) Thanks! I'm really curious about this one.
Advertisement
Look up "Arbitrary Precision Math". Also, I've seen people mention the BigNum library, but I'm not familiar enough with it to even be sure that's the right name, let alone for C++.
We''re sorry, but you don''t have the clearance to read this post. Please exit your browser at this time. (Code 23)
GMP is used by a number of professional enterprises, and it's GPL so you can study and modify the code yourself.

Stephen M. Webb
Professional Free Software Developer

This topic is closed to new replies.

Advertisement