ID:2945052
 
Resolved
Integers beyond the limit of 32-bit ints were compiled incorrectly, capping them out at 2**31 instead of compiling as an approximated floating point number.
BYOND Version:515
Operating System:Windows 11 Pro 64-bit
Web Browser:Chrome 128.0.0.0
Applies to:Dream Maker
Status: Resolved (515.1644)

This issue has been resolved.
Descriptive Problem Summary:

If you define a variable that's a number, and you don't explicitly make it into a float, it is capped at INT_MAX. This is very unintuitive unless you know BYOND's DM compiler has cursed internals.

Numbered Steps to Reproduce Problem:
run the code

Code Snippet (if applicable) to Reproduce Problem:
/world/New()
..()

var/obj/a/my = new
world.log << my.happy
world.log << my.sad

eval("")
shutdown()

/obj/a
var/happy = 6000000000000.0
var/sad = 6000000000000


Expected Results:
6e+12
6e+12

Actual Results:
6e+12
2.14748e+09

When does the problem NOT occur?
idk bro

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked?
Happens in 514 also

Workarounds:
explicit float

Lummox JR resolved issue with message:
Integers beyond the limit of 32-bit ints were compiled incorrectly, capping them out at 2**31 instead of compiling as an approximated floating point number.

Login to reply.