ID:1904278
 
(See the best response by Super Saiyan X.)
Code:


Problem description:

Okay so say i have a variable of an object set to 4250000000 once the world is loaded its hard capped to 2147483647 is this intended behavior can it be overridden besides editing the object while its in the map editor?

IT seems this is avoided if you simply write the number in scientific notation.
In BYOND, numbers don't go higher than 2147483647 or lower than -2147483648. This is because BYOND handles integers in 32-bit format.

https://en.wikipedia.org/wiki/2147483647

64-bit integers, as food for thought, go as high as 9223372036854775808. Crazy, right?
Can I just point out that if your variables are that obnoxious, you may want to rethink scaling everything back a few powers of ten.
In response to Doohl
Doohl wrote:
In BYOND, numbers don't go higher than 2147483647 or lower than -2147483648. This is because BYOND handles integers in 32-bit format.

https://en.wikipedia.org/wiki/2147483647

64-bit integers, as food for thought, go as high as 9223372036854775808. Crazy, right?

Yes I am aware.

I'm just saying this doesn't happen for example if i write it as 4.25e009 it works perfectly then why is that?
In response to Gokussj99
I'm pretty sure that's because, internally, it's no longer stored as just an integer if it's in scientific notation.

I could be wrong, however!
Best response
Because that value (in exponent form) would be expanded at runtime because the value can be compiled without accuracy.

If you compile it as a pure integer, the compiler is like "this number is too damn high!" and can only write it as the highest sign'd 32-bit number.

Runtime limit is higher than compile time limit.

Why are you hard-coding a number that high?
In response to Super Saiyan X
Super Saiyan X wrote:
Because that value (in exponent form) would be expanded at runtime because the value can be compiled without accuracy.

If you compile it as a pure integer, the compiler is like "this number is too damn high!" and can only write it as the highest sign'd 32-bit number.

Runtime limit is higher than compile time limit.

Why are you hard-coding a number that high?

Eh a re-creation of an old dragonball mud i use to play back in the late 90's early 2000s high numbers ftw lol.

Just nostalgia really fun playing with some old friends.
2147483647 can be achieved for certain values set at compile-time, but basically BYOND does most of its number work with 32-bit floats. The highest number you can use with integer-level accuracy is 2**24, and the lowest is -2**24.
So when OP says the instance editor works, that's because it sets the value at runtime rather than compile time. So theoretically if you set your big values in New() instead of as a definition, it would work.
I'm just saying this doesn't happen for example if i write it as 4.25e009 it works perfectly then why is that?

If you try to do 4250000000, byond trys to store it as 4250000000, and runs out of space in the memory allocated to numbers.

If you try to do 4.25e009, it will store that number just like that, in E notation, or rather, it stores it as 0101100425, expanded out to, 425*10**11. (roughly, It's been awhile since i cared about how floats stored themselves in memory)




In response to Kaiochao
Kaiochao wrote:
So when OP says the instance editor works, that's because it sets the value at runtime rather than compile time. So theoretically if you set your big values in New() instead of as a definition, it would work.

Tried in New() doesn't work anyway this was solved by formatting it I notation.
you could always make the number have a word next to it for each e+006 or w/e so when it hits 009 its just like 2 billon 3 trillion based off the 000 number instead of actual numbers