[The Grinns Tale] Integer overflow?

8 posts

Flag Post

I noticed that i had thousands and thousands of trash, literal trash; Rusty screws, squeaky springs, small nuts, etc, and I was wondering if sometime in the future they may cause integer overflow and crash my game. I think flash can support tens of thousands; if not hundreds or thousands of thousands; of integers, but will it someday, eventually, overflow?

 
Flag Post

I don’t think so, wait until one reaches 10000, then you’ll see. You will never reach 100000 anyway.

 
Flag Post

i’m at 33k screws.

but seeing as you can have 484k wood, we’re probably nowhere near the integer limit yet..

 
Flag Post

you will hit an overflow when you reach 2,147,483,648 of something.

 
Flag Post

Wow. How do you know? (Really I wonder)

 
Flag Post

In fact, it would be 4.294.967.296 , because large integers only count up to 32 bits, not 31, as donder posted, The way of calculating it is easy, 2 to the power of the maximum bits, 32

 
Flag Post

That’s true if they only use positive numbers. Even in flash, usually, the last bit is for sign so you only get 31 to use for the number itself. Eitherway, you will never be able to do something that will cause an overflow :D

 
Flag Post

Yep, most probably