• Advertisement

Archived

This topic is now archived and is closed to further replies.

Using SUPER big numbers!

This topic is 5406 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

Howdy! I need to use numbers beyond the range of unsigned int variables... The numbers I''m working with will all be positive but will be in the area of 5 to 10 times the max value of an unsigned int. How do I go about messing with values that high? Thanks, Gorf

Share this post


Link to post
Share on other sites
Advertisement
do a google search for "big integers"--that''s the technical term.


How appropriate. You fight like a cow.

Share this post


Link to post
Share on other sites
You could use Lisp. Lisp handles big numbers transparently and elegantly, by switching representation when the number would overflow.

You could also use java, which has a BigInteger class.

Finally, I believe there is a Gnu numerics library(or something similar to that) which has big integers for c(or maybe c++, never used it).

Share this post


Link to post
Share on other sites
Just out of curiosity... why do you need such high value numbers?

Could you not use some sort of scaling so that your numbers fall into a more ''friendly'' and generic data type?

Regards,
Sharky


---
#define _WEBSITE
Sharky''s Coding Corner
#endif
---

Share this post


Link to post
Share on other sites
I did something similar to what your talking about in VB6. I had created my own data type made up of 5 doubles and then made a bunch of functions to make it so that I could use those 5 doubles as one number. I forget the exact range I achieved. It was for a final project.



- Rob Loach
Current Project: Go Through Object-Oriented Programming in C++ by Robert Lafore

"Do or do not. There is no try."
- Yoda

Share this post


Link to post
Share on other sites
unsigned _int64, or long long, whatever your compiler calls them. 264-1 should be enough ?

Share this post


Link to post
Share on other sites

  • Advertisement