Jump to content
  • Advertisement
Sign in to follow this  

Big Numbers

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

Im working with c++ and I need something bigger than a 64 bit unsigned integer(ULONGLONG). It needs to only support multiplikation, division or shifting, modulos. -CProgrammer

Share this post


Link to post
Share on other sites
Advertisement
You can use a premade BigInt class or make your own. Personally, it's funner to make your own, but I'm sure you can find some well made ones elsewhere if you don't have the patience/time.

Share this post


Link to post
Share on other sites
Sorry but Ive been searching google quite some time now but I cant find any usable class or library.
And I dont really know where to start making my own.

-CPogrammer

Share this post


Link to post
Share on other sites
For crist sake all I want is a integer class that functions like normal ints only more than 64 bit. Why is it so difficult to get this basic simple and every used class.
I downloaded GMP but Im kindof in a hurry and it just aint very user friendly, I found an integer.h file built on gmp on the web but cant seem to find the whole package.
Geeze.
Help is apreciated.
Thanks
-CProgrammer

Share this post


Link to post
Share on other sites
Quote:
Original post by CProgrammer
For crist sake all I want is a integer class that functions like normal ints only more than 64 bit. Why is it so difficult to get this basic simple and every used class.
I downloaded GMP but Im kindof in a hurry and it just aint very user friendly, I found an integer.h file built on gmp on the web but cant seem to find the whole package.
Geeze.
Help is apreciated.
Thanks
-CProgrammer

Because computers are limited to 32/64 bits. Their built-in integers are only 64-bit long (or 32-bit on 32-bit computers). If you need more than that, you need to write your own, and I strongly suggest that. You don't know where to start? Then probably programming is not for you? Really, the solution is very intuitive. If you can't figure it out, then, I don't know, stick to 64-bit? use someone else's library that is hard to use (programmers...[rolleyes])? or write your own.

Share this post


Link to post
Share on other sites
Make a struct

struct MYBIGASSINT
{
int myBigpart;
int mySmallPart;
MYBIGASSINT operator+(MYBIGASSINT &mbai);
MYBIGASSINT operator*(MYBIGGASSINT &mbai);
MYBIGASSINT operator/(MYBIGASSINT &mbai);
MYBIGASSINT operator%(MYBIGASSINT &mbai);
MYBIGASSINT operator+=();
MYBIGASSINT operator*=();
MYBIGASSINT operator/=();
MYBIGASSINT operator%=();
bool operator!=();
bool operator==();
}

now fill it in :P i wont do it for u but the point is abstract it so it looks like a built in data type for most functions

Share this post


Link to post
Share on other sites
You're right I apologize.
Ive been having a bit of a bad day.
Maybe I best get to work on it tomorrow.

I still find it a bit odd though that something so widely used in math and physics never made it into some standard library.

-CProgrammer

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!