For some reason, BYOND is bad at involving math that includes subtracting numbers smaller than 1.
An example is having a variable at 1.2, then subtracting 0.4 from it 3 times, it should go from 1.2, to 0.8, to 0.4, to 0. But when the number should reach 0, it does not. Instead it turns into some crazy number like 5.96046e-008.
It may also work with other numbers, but I have only tried subtracting from a number that is a multiple of 0.4 (0.4, 0.8, 1.2, 1.6, 2 and so on).
Numbered Steps to Reproduce Problem:
Just follow the code snipper below to see what I mean
Code Snippet (if applicable) to Reproduce Problem:
mob/verb/CrazyMath()
var/a=1.2
usr << a //1.2
a-=0.4
usr << a //0.8
a-=0.4
usr << a //0.4
a-=0.4
usr << a //0
Expected Results: a should be 0.
Actual Results:It is actually 5.96046e-008 (when I test it).
Does the problem occur:
Every time? Or how often? Everytime
In other games? Yep
In other user accounts? Most likely
On other computers? No idea, cannot test
When does the problem NOT occur?
Workarounds:
You can round the number down.