Mizuchiro
1 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?
|
mosemizrahi
421 posts
|
I don’t think so, wait until one reaches 10000, then you’ll see. You will never reach 100000 anyway.
|
RedeemedWahrior
213 posts
|
i’m at 33k screws.
but seeing as you can have 484k wood, we’re probably nowhere near the integer limit yet..
|
donder
10 posts
|
you will hit an overflow when you reach 2,147,483,648 of something.
|
mosemizrahi
421 posts
|
Wow. How do you know? (Really I wonder)
|
PauCano
3 posts
|
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
|
donder
10 posts
|
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
|
PauCano
3 posts
|
|