overflow

Started by
4 comments, last by UeberBobo 20 years, 1 month ago
what can i do when unsigned long int is not enough and i need to store numbers bigger than that (2^32 right?) thanks
//---------//Ueberbobo//*********
Advertisement
Use __int64 if you are using a VC compiler. It holds 2^64 bits.
Some compilers support long long int, which is also 64 bits wide.

[edited by - biovenger on April 10, 2004 7:09:41 AM]
-----------------------------Final Frontier Trader
All compilers support long long int, but on a lot of architectures it won''t be 64 bits.

Ueber, a floating point number can store much larger numbers than an integer. Of course, very large numbers will not be precise.

"Sneftel is correct, if rather vulgar." --Flarelocke
_int64 under MS VC

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winprog/winprog/large_integer_functions.asp

These functions may help as 64 bit ints are made up of two 32 bit vars jammed together. I''m under the impression they are a real pain to use and slow too due to 32 bit cpu''s having to decode and encode them all the time. I''d try to give them a miss for a game if at all possible.

Jay
quote:Original post by Sneftel
All compilers support long long int, but on a lot of architectures it won''t be 64 bits.
...


Sorry for not being clear, that was what I meant. After all, he wanted more than 32 bits integer precision. Thanks for clearing that one out.

Easiest way to check if your compiler has 64 bit long long ints is to just make a simple std::cout << sizeof(long long int); and see what happens. If you get 8, your compiler compiles lli''s as 64 bits.
-----------------------------Final Frontier Trader
my code works now, many thanks
//---------//Ueberbobo//*********

This topic is closed to new replies.

Advertisement