Found an interesting problem with a program I wrote. If I use a value greater than 999,999,999 for a long long int it acts like an overflow to the int and the program freaks out. long long int has/(should have) a range of: –9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 ..... 19 digit places, whereas the program is failing as if there is an overflow with more than 9 digits.
Was curious if this is a bug with the IDE or some other issue that I am not aware of. I'm using Bloodshed Dev C++ 4.9.9.2. More info on the ranges for variables listed at the link.
https://msdn.microsoft.com/en-us/library/s3f49ktz.aspxThe program has all integers that are to interact with the long long int set to long long so that I dont overflow a standard int. So I know its not a mistake of passing a long long int value to a standard int with only a range of –2,147,483,648 to 2,147,483,647 by which even a standard int shouldn't be exceeded either as for I am 1,147,483,648 away from the standard signed int limit at 999,999,999
The code is in C++ and has a while loop and the value of the long long is passed to srand(seed). So maybe 999,999,999 is the limit for seeded random?
However looking here it shows that it should go beyond the 999,999,999 limit that I am hitting. If I pass 1,000,000,000 to it the program malfunctions as if its an overflow.
http://en.cppreference.com/w/cpp/numeric/random/rand