Jump to content
  • Advertisement

Archived

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

Wutalife37

Longer than Long?

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

Is there any integer data type that can store numbers larger than unsigned long? I''ve heard of things like long long, but I can''t find any information on them.

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
http://www.swox.com/gmp/

"GMP is a free library for arbitrary precision arithmetic, operating on signed integers, rational numbers, and floating point numbers. There is no practical limit to the precision except the ones implied by the available memory in the machine GMP runs on. GMP has a rich set of functions, and the functions have a regular interface."

That should be big enough.

Share this post


Link to post
Share on other sites
I tried using __int64 but I got the error "''operator <<'' is ambiguous" for every point in the program that I used cout << n. Where n is defined as __int64. I''m using VC++ 6.0

Share this post


Link to post
Share on other sites
quote:
Original post by Wutalife37
I tried using __int64 but I got the error "''operator <<'' is ambiguous" for every point in the program that I used cout << n. Where n is defined as __int64. I''m using VC++ 6.0


Yeah, unfortunately it isn''t as widely supported as well as we would all like Luckily, you can do a lot of math operations on it, but you might have to write your own insertion/extraction operators.

My guess is that 64 bit ints will become more widely-supported (in standard libraries) once the 64-bit desktop is in widespread use.

Share this post


Link to post
Share on other sites
I suppose you could define your own << operator. You''d probably have to do some kind of bit shifting into two 32-bit integers, then display the number using those.

---------------------------------------

Let''s struggle for our dream of Game!

http://andrewporritt.4t.com

Share this post


Link to post
Share on other sites
printf and similar functions do support 64-bit integers (at least the versions that come with VC++ 6). Something like this:


__int64 ALargeNumber = 283493098230982525;
printf("%I64d", ALargeNumber);
You could then overload << and >> as mentioned above by using printf and scanf.

Also, for MSDN documentation, see here and here.

[edited by - Agony on January 15, 2004 2:45:43 PM]

Share this post


Link to post
Share on other sites
in VB, Microsoft made a data type called Currency, which has about twice as many digits as a long, but only holds 4 decimal values. I''m not sure, but it might be in VC++ also...

Share this post


Link to post
Share on other sites
quote:
Original post by jerubaal
in VB, Microsoft made a data type called Currency, which has about twice as many digits as a long, but only holds 4 decimal values. I''m not sure, but it might be in VC++ also...

No sir.

Share this post


Link to post
Share on other sites

  • 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!