Jump to content
  • Advertisement
Sign in to follow this  
GenuineXP

Representing Huge Numbers

This topic is 4271 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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++.

Share this post


Link to post
Share on other sites
GMP is used by a number of professional enterprises, and it's GPL so you can study and modify the code yourself.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!