Addition appears to become increasingly inaccurate as the numbers being added get very large.
Code Snippet (if applicable) to Reproduce Problem:
Compile & Run this in dream maker. Output however you like.
num2text(16777215 + 16777216, 8)
Expected Results:
Should output 33554431
Actual Results:
Actually outputs 33554432
Does the problem occur every time?
It occurs every time. Larger numbers than these will give more and more inaccurate results.
When does the problem NOT occur?
When the numbers are small but I'm not sure at what exact point the error will start creeping in.
BYOND holds numbers in 32-bit floats. 1 bit is used for sign, and 7 bits are used for exponent, leaving 24 bits for actual number data. 24 bit numbers can only go as high as 16777215 before precision begins to falter.
Floats are good for making calculations of numbers that can be very big or small, but when it comes to the number of significant digits, they can be a bit lacking.